pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Aaron Bono <postgresql@aranya.com>
To: Michael Fuhr <mike@fuhr.org>
Cc: Rod Taylor <pg@rbt.ca>
Cc: John DeSoi <desoi@pgedit.com>
Cc: chester c young <chestercyoung@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: sessions and prepared statements
Date: Fri, 16 Jun 2006 09:29:13 -0500
Message-ID: <bf05e51c0606160729o193572d8haf0898c334010edb@mail.gmail.com> (raw)
In-Reply-To: <20060616130921.GA31604@winnie.fuhr.org>
References: <20060615154930.44620.qmail@web54312.mail.yahoo.com>
	<4B156402-1B7D-46E2-8A4F-9DBD3F119CB7@pgedit.com>
	<1150462516.777.550.camel@home>
	<20060616130921.GA31604@winnie.fuhr.org>

If you are using pooled connections, doesn't PostgreSQL manage the prepared
statements for you?  I would expect that, once I prepare a statement, if I
attempt to do it again, PostgreSQL would say, "righty then, already done it,
here you go".  Then again, I don't know what PostgreSQL does under the
covers.

This seems like a lot of work to squeek out a small amount of efficiency.
Would it really give you much value?

-Aaron Bono

On 6/16/06, Michael Fuhr <mike@fuhr.org> wrote:
>
> On Fri, Jun 16, 2006 at 08:55:16AM -0400, Rod Taylor wrote:
> > BEGIN;
> > SAVEPOINT;
> > SELECT * FROM temporary_prepared_statement;
> > ROLLBACK TO SAVEPOINT < on failure>;
> > CREATE TEMPORARY TABLE temporary_prepared_statement ...;
> > COMMIT;
> >
> > Now you have a place to store and retrieve prepared connection state for
> > the lifetime of the database backend provided PHP doesn't remove
> > temporary tables on the connection.
>
> This doesn't help today, but 8.2 will have a pg_prepared_statements
> view.
>
> http://archives.postgresql.org/pgsql-committers/2006-01/msg00143.php
>
> http://developer.postgresql.org/docs/postgres/view-pg-prepared-statements.html
>
> test=> PREPARE stmt (integer) AS SELECT * FROM foo WHERE x = $1;
> test=> \x
> Expanded display is on.
> test=> SELECT * FROM pg_prepared_statements;
> -[ RECORD 1
> ]---+----------------------------------------------------------
> name            | stmt
> statement       | PREPARE stmt (integer) AS SELECT * FROM foo WHERE x =
> $1;
> prepare_time    | 2006-06-16 07:07:41.682999-06
> parameter_types | {integer}
> from_sql        | t
>
> --
> Michael Fuhr

view thread (6+ messages)  latest in thread

Message-ID: <bf05e51c0606160729o193572d8haf0898c334010edb@mail.gmail.com>
Permalink:  ../bf05e51c0606160729o193572d8haf0898c334010edb@mail.gmail.com/
Also on:    postgresql.org/message-id/bf05e51c0606160729o193572d8haf0898c334010edb@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: postgresql@aranya.com, mike@fuhr.org, pg@rbt.ca, desoi@pgedit.com, chestercyoung@yahoo.com
  Subject: Re: sessions and prepared statements
  In-Reply-To: <bf05e51c0606160729o193572d8haf0898c334010edb@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox