Re: Under what circumstances does PreparedStatement use stored - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Under what circumstances does PreparedStatement use stored
Date
Msg-id 40772C13.4030900@opencloud.com
Whole thread Raw
In response to Under what circumstances does PreparedStatement use stored plans?  (James Robinson <jlrobins@socialserve.com>)
Responses Re: Under what circumstances does PreparedStatement use stored plans?
List pgsql-jdbc
James Robinson wrote:
> Subject pretty much tells it all -- under what circumstances does
> PreparedStatement use backend-based stored plans, and when are those
> plans removed from the database?

In the CVS driver, it's controlled by calling a method on
org.postgresql.PGStatement on the prepared statement in question; by
default it's off.

For a patch that provides a bit more transparency try:

   http://archives.postgresql.org/pgsql-jdbc/2003-12/msg00019.php

This patch allows you to specify a threshold at the datasource level
(via a property or URL parameter). PreparedStatement objects that are
reused more than the threshold begin to use server-side prepared queries
automatically. I put this patch together for a similar case to your
JBoss case -- where server-side prepared queries are useful, but
modifying the actual JDBC client code to call a postgresql-specific
method isn't easy.

Note that there are still a few corner cases where server-prepared
queries do not operate correctly in the face of query errors. See:

   http://archives.postgresql.org/pgsql-jdbc/2003-12/msg00015.php.

-O

pgsql-jdbc by date:

Previous
From: Barry Lind
Date:
Subject: Re: Under what circumstances does PreparedStatement use stored
Next
From: Oliver Jowett
Date:
Subject: Re: Connection Idle in transaction