Re: [PERFORM] Bulk persistence strategy - Mailing list pgsql-performance

From Merlin Moncure
Subject Re: [PERFORM] Bulk persistence strategy
Date
Msg-id CAHyXU0xz9oGMoM26bc3-RbEb0wtMycrMzxos6wnpaB4jtKmAPw@mail.gmail.com
Whole thread Raw
In response to Re: [PERFORM] Bulk persistence strategy  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
On Sun, May 21, 2017 at 5:37 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Riaan Stander <rstander@exa.co.za> writes:
>> The intended use is use-once. The reason is that the statements might
>> differ per call, especially when we start doing updates. The ideal would
>> be to just issue the sql statements, but I was trying to cut down on
>> network calls.
>
> Hm, well, feeding data forward to the next query without a network
> round trip is a valid concern.
>
> How stylized are these commands?  Have you considered pushing the
> generation logic into the function, so that you just have one (or
> a few) persistent functions, and the variability slack is taken
> up through EXECUTE'd strings?

+1.  If 'DO' could return a value and take arguments, we'd probably
just use that.  With the status quo however the SQL generation
facilities need to be moved into the database as dynamic SQL (that is,
executed with EXECUTE).  This will provide the speed benefits while
maintaining (albeit with some rethinking) your abstraction model
Please make liberal use of quote_ident() and quote_literal() to
minimize security risks.

merlin


pgsql-performance by date:

Previous
From: Ariel
Date:
Subject: [PERFORM] index of only not null, use function index?
Next
From: Jeff Janes
Date:
Subject: [PERFORM] select subquery versus join subquery