From: Heikki Linnakangas <heikki@enterprisedb.com>
To: lindner@inuus.com
Cc: Oliver Jowett <oliver@opencloud.com>
Cc: Josh Berkus <josh@agliodbs.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Prepared Statements vs. pgbouncer
Date: Mon, 01 Oct 2007 09:38:52 +0100
Message-ID: <4700B21C.1000008@enterprisedb.com> (raw)
In-Reply-To: <47000C2E.8030409@opencloud.com>
References: <20070929002513.GG3140@inuus.com>
<46FDA4F2.8080507@opencloud.com>
<20070929021522.GH3140@inuus.com>
<24584.1191033096@sss.pgh.pa.us>
<20070929072159.GI3140@inuus.com>
<46FE3B1A.7020603@agliodbs.com>
<46FED7FA.6060309@opencloud.com>
<46FFC314.5080205@agliodbs.com>
<47000C2E.8030409@opencloud.com>
Oliver Jowett wrote:
> Josh Berkus wrote:
>> Oliver,
>>
>>> S_1 from client 1 might be a completely different query to S_1 from
>>> client 2. The JDBC driver just numbers statements sequentially as
>>> they are used.
>>
>> So, how does j2EE-side connection pooling handle this?
>
> Err.. it is dealing with JDBC connections, not protocol level stuff, so
> there's no issue with statement naming. The driver just does what it
> normally does (maintains a mapping of query to statement name on each
> connection). The usual J2EE connection pool model is different to what
> pgbouncer apparently does as clients explicitly return connections to
> the pool when no longer needed -- which effectively invalidates any
> PreparedStatement objects they might still be holding -- and reobtain
> them when later need.
The OP might be better off doing the connection multiplexing at a higher
level as well. You could use something like Virtual JDBC
(vjdbc.sourceforge.net) between the clients and a connection pool
managed in the multiplexer. There would be no problem with prepared
statements, since the JDBC driver would deal with real connections to
the database. I've never used vjdbc myself, so I don't know if it's
applicable, but something along those lines should work.
You might also consider if using pgbouncer or similar really is
necessary. Perhaps you could get away with a per-client connection pool,
with "min pool size" small enough, maybe 0, that the number of
simultaneous connections to the server would stay reasonable.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: heikki@enterprisedb.com, lindner@inuus.com, oliver@opencloud.com, josh@agliodbs.com
Subject: Re: Prepared Statements vs. pgbouncer
In-Reply-To: <4700B21C.1000008@enterprisedb.com>
References: <20070929002513.GG3140@inuus.com> <46FDA4F2.8080507@opencloud.com> <20070929021522.GH3140@inuus.com> <24584.1191033096@sss.pgh.pa.us> <20070929072159.GI3140@inuus.com> <46FE3B1A.7020603@agliodbs.com> <46FED7FA.6060309@opencloud.com> <46FFC314.5080205@agliodbs.com> <47000C2E.8030409@opencloud.com> <4700B21C.1000008@enterprisedb.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox