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