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