Re: Prepared statement already exists

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: WireSpot <wirespot(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Prepared statement already exists
Date: 2008-11-20 13:30:18
Message-ID: 20081120133018.GA3810@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Merlin Moncure escribió:
> On Wed, Nov 19, 2008 at 2:42 PM, WireSpot <wirespot(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message WireSpot 2008-11-20 13:39:01 Re: Prepared statement already exists
Previous Message Frank Bax 2008-11-20 13:22:25 Re: [SQL] date range query help