Re: Prepared Statements - Mailing list pgsql-general

From Isak Hansen
Subject Re: Prepared Statements
Date
Msg-id 6b9e1eb20801100412w6f951dd6y9de1e39a0c5805a8@mail.gmail.com
Whole thread Raw
In response to Re: Prepared Statements  (mljv@planwerk6.de)
List pgsql-general
On 1/10/08, mljv@planwerk6.de <mljv@planwerk6.de> wrote:
> > >
> > > I have not found anything about preparing "unnamed" statements. What
> > > does it mean?
> >
> > Unnamed statements are what the driver uses before it hits the
> > prepareThreshold limit.  Once it has determined the statement will be
> > reused many times it changes to a named statement that has a longer
> > lifespan.
>
> What do you mean with "longer lifespan"? Doesn't the JDBC driver uses the
> PREPARE Sql Statement and therefore the prepared Statement has the same
> lifespan as the connection? If so, as connections are pooled and never
> closed, the prepared Statement will last forever. What if the table analyzes
> changes and a better execution plan could be found?
>

An unnamed prepared query is just a normal one-shot query, but it
allows the use of bind variables.

You'll find more details in the protocol section of the postgres docs
<http://www.postgresql.org/docs/8.3/static/protocol.html>.


Regards,
Isak

pgsql-general by date:

Previous
From: Sebastián Baioni
Date:
Subject: Re: Can't make backup
Next
From: Stefan Schwarzer
Date:
Subject: Re: Installation problem: failed to initialize lc_messages to ""