Re: Prepared Statements vs. pgbouncer

From: Paul Lindner <lindner(at)inuus(dot)com>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: Paul Lindner <lindner(at)inuus(dot)com>, 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:55:11
Message-ID: 20071001215511.GS3140@inuus.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Tue, Oct 02, 2007 at 10:19:56AM +1300, Oliver Jowett wrote:
> 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.

Okay, Okay, I have read much of

http://www.postgresql.org/docs/current/static/protocol.html

and much of

src/backend/tcop/postgres.c

and much of

src/backend/commands/portalcmds.c

I'm a newbie here, but it appears that PerformCursorOpen() is callable
from the SQL grammar, not directly via the protocol.

My apologies for mixing up PL/PGSQL and V3 protocol.

--
Paul Lindner ||||| | | | | | | | | |
lindner(at)inuus(dot)com

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message hubert depesz lubaczewski 2007-10-02 12:38:38 Re: Prepared Statements vs. pgbouncer
Previous Message Oliver Jowett 2007-10-01 21:46:44 Re: Prepared Statements vs. pgbouncer