Re: Under what circumstances does PreparedStatement use stored

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: James Robinson <jlrobins(at)socialserve(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Under what circumstances does PreparedStatement use stored
Date: 2004-04-09 23:04:51
Message-ID: 40772C13.4030900@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2004-04-09 23:11:11 Re: Connection Idle in transaction
Previous Message Barry Lind 2004-04-09 21:21:11 Re: Under what circumstances does PreparedStatement use stored