Re: NOT EXIST for PREPARE

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Yury Zhuravlev <u(dot)zhuravlev(at)postgrespro(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Tatsuo Ishii <ishii(at)postgresql(dot)org>
Subject: Re: NOT EXIST for PREPARE
Date: 2016-03-25 13:36:00
Message-ID: CAHyXU0x_FAS+Oyi9np-gncbTyzjO6WL6Onmppf+Dp85tkHmLSQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 23, 2016 at 3:10 PM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
> Merlin,
>
> * Merlin Moncure (mmoncure(at)gmail(dot)com) wrote:
>> No one is arguing that that you should send it any every time (at
>> least -- I hope not).
>
> I'm not sure I follow how you can avoid that though?
>
> pgbouncer in transaction pooling mode may let a particular connection
> die off and then, when you issue a new request, create a new one- which
> won't have any prepared queries in it, even though you never lost your
> connection to pgbouncer.
>
> That's why I was saying you'd have to send it at the start of every
> transaction, which does add to network load and requires parsing, etc.
> Would be nice to avoid that, if possible, but I'm not quite sure how.
>
> One thought might be to have the server somehow have a pre-canned set of
> queries already set up and ready for you to use when you connect,
> without any need to explicitly prepare them, etc.
>
> Just a thought. I do still like the general idea of INE support for
> PREPARE, but perhaps there's a better option.

Admittedly, you make some pretty good points here. I guess one
strategy would be to move them all to a function that sets an advisory
lock to signal they've been prepared. That's pretty safe even in
multi-threaded scenarios since only one thread can send queries to the
backend at a time. Advisory locks are pretty arcane though. Still,
I'm coming round to your (and Andres's) point of view. :/

merlin

merlin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-03-25 13:48:00 Re: [COMMITTERS] pgsql: Move each SLRU's lwlocks to a separate tranche.
Previous Message Thom Brown 2016-03-25 13:25:41 Re: Breakage with VACUUM ANALYSE + partitions