Re: Prepared Statements vs. pgbouncer - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Prepared Statements vs. pgbouncer
Date
Msg-id 4701647C.8050305@opencloud.com
Whole thread Raw
In response to Re: Prepared Statements vs. pgbouncer  (Oliver Jowett <oliver@opencloud.com>)
Responses Re: Prepared Statements vs. pgbouncer
List 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

pgsql-jdbc by date:

Previous
From: Paul Lindner
Date:
Subject: Re: Prepared Statements vs. pgbouncer
Next
From: Paul Lindner
Date:
Subject: Re: Prepared Statements vs. pgbouncer