Re: Prepared statement already exists - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Prepared statement already exists
Date
Msg-id 20081120133018.GA3810@alvh.no-ip.org
Whole thread Raw
In response to Re: Prepared statement already exists  ("Merlin Moncure" <mmoncure@gmail.com>)
Responses Re: Prepared statement already exists  (WireSpot <wirespot@gmail.com>)
List pgsql-general
Merlin Moncure escribió:
> On Wed, Nov 19, 2008 at 2:42 PM, WireSpot <wirespot@gmail.com> wrote:

> > 3) Reading a list of all the currently defined prepared statements to
> > see if the one I want is already prepared. I'm hoping some "magic"
> > SELECT in pg's internal tables may do the trick. But I also worry
> > about introducing overhead this way.
>
> pg_prepared_statements (on recent versions of postgresql)
>
> also, watch out for race conditions.

What race conditions?  Prepared statements are per-connection.

Perhaps the application could keep a hash of statements prepared so far,
to avoid having to query pg_prepared_statements all the time.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

pgsql-general by date:

Previous
From: Frank Bax
Date:
Subject: Re: [SQL] date range query help
Next
From: WireSpot
Date:
Subject: Re: Prepared statement already exists