Re: pooled prepared statements - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: pooled prepared statements
Date
Msg-id Pine.BSO.4.64.0905141451530.12930@leary.csoft.net
Whole thread Raw
In response to Re: pooled prepared statements  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-jdbc

On Wed, 13 May 2009, Oliver Jowett wrote:

> Thomas Finneid wrote:
>
>> When a PreparedStatment is created by a pooled connection, as far as I
>> understand if, that creation happens on the server side, and a
>> reference, of sorts, is returned to the client jdbc.
>
> More or less, yes. (Assuming you're reusing the statement, not just
> using it once and discarding it).
>

It really depends on the driver and connection pool that you are using.
The idea of having a PreparedStatement cache (that doesn't require
retaining a reference to the PreparedStatement) has been suggested for the
driver, but rejected.  A connection pool which proxies the real connection
can provide this functionality instead.  The pooler provided with the
postgresql driver does not do this, but for example DBCP can.

So as long as your pool or driver are reasonably smart, don't overthink
this and let them handle it for you.

Kris Jurka

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: COPY support: plan and progress
Next
From: David Rees
Date:
Subject: Re: v604 in Maven