Re: Prepared Statements vs. pgbouncer

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Paul Lindner <lindner(at)inuus(dot)com>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, Heikki Linnakangas <heikki(at)enterprisedb(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Prepared Statements vs. pgbouncer
Date: 2007-10-01 21:19:56
Message-ID: 4701647C.8050305@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Oliver Jowett wrote:
> Paul Lindner wrote:
>
>> Why doesn't the Postgres JDBC driver use cursors for ResultSets
>> instead of creating prepared statements? Is this not supported in the
>> v3 protocol? (I'd answer this question myself, but no time to read
>> code at the moment...)
>
> It uses portals which are the v3 equivalent of cursors.

To elaborate a bit more: you need a statement before you can create a
portal, and the unnamed statement is no use for this particular case as
we need the portal to live despite reuse of the unnamed statement, and
the implicit close of the unnamed statement on reuse also causes any
dependant portal to close. So we must use a named statement so that we
can control the lifetime of the portal correctly.

-O

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Paul Lindner 2007-10-01 21:32:37 Re: Prepared Statements vs. pgbouncer
Previous Message Paul Lindner 2007-10-01 21:09:22 Re: Prepared Statements vs. pgbouncer