pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Paul Lindner <lindner@inuus.com>
To: Josh Berkus <josh@agliodbs.com>
Cc: Heikki Linnakangas <heikki@enterprisedb.com>
Cc: lindner@inuus.com
Cc: Oliver Jowett <oliver@opencloud.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Prepared Statements vs. pgbouncer
Date: Mon, 1 Oct 2007 12:31:53 -0700
Message-ID: <20071001193153.GN3140@inuus.com> (raw)
In-Reply-To: <4701402A.2020804@agliodbs.com>
References: <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>
	<47013A0E.6080607@agliodbs.com>
	<47013ECA.1060400@enterprisedb.com>
	<4701402A.2020804@agliodbs.com>

On Mon, Oct 01, 2007 at 11:44:58AM -0700, Josh Berkus wrote:
> Heikki,
> 
> >It's clearly pgBouncer here that's braking the protocol, so it's
> >pgBouncer that needs fixing. A workaround in JDBC driver would only help
> >JDBC apps. If you're having non-java applications in the mix, you'd have
> >to implement the workaround in *all* the drivers.
> >
> >BTW: I just stumbled across this Greg Sabine Mullane's blog post, which
> >describes a workaround for DBD::Pg perl module, so we're not alone:
> >http://people.planetpostgresql.org/greg/index.php?/archives/110-Using-DBDPg-with-pg_bouncer.html
> >
> 
> Well, I think we have the right group of people here to think about what 
> needs to be fixed.  One of the Sun engineers can help with it, which I 
> think is necessary since I doubt Marco has the time.

> So, given pgBouncer's purpose, what exactly should it be doing to handle 
> prepared connections?  That is, how can it support the v3 protocol 
> without eliminating its tremendous scalability?

Here's a couple of ideas:

* Make more commands have modes that ignore errors.  This allows for
  idempotent behavior and won't result in transactions failing.

    PREPARE IF NOT EXISTS foo() AS xxxx
    PREPARE OR REPLACE foo() AS xxxx
    DEALLLOCATE IF EXISTS foo;

  Or fix the general case and allow for a way to catch errors without
  invalidating the transaction.

* make it possible to request server-side state be transaction-scoped.
  For example, prepared-statements, temporary tables, and the like
  could be cleaned up at the end of a transaction automatically.  Some
  of this behavior exists already:

    CREATE TEMP TABLE foo (integer a) on commit drop;

  I think temporary views, temporary tables, and prepared statements
  are the big things here.

* Have server-side support for 'pooled' connections.  If you request a
  pooled connection then certain features will be disabled to insure
  that server-side state is contained properly.

  This could be specified on connection, or perhaps it could be
  specified as a user attribute...

  For example, if this was in place no session state modifications
  could occur outside a transaction.

* Have some way of dumping and restoring transient state.  This would
  allow pgbouncer to preserve client state without having to intercept
  and track all of the various temporary information.  Something
  simple like this would suffice.

    SHOW CLIENTSTATE;

    clientstate
    --------------------
    aa$*afjhak1324834....

    SET CLIENTSTATE="aa$*afjhak1324834...."

  .. or ..

  Have the database itself track client state separate from backend
  processes.



-- 
Paul Lindner        ||||| | | | |  |  |  |   |   |
lindner@inuus.com

view thread (48+ messages)  latest in thread

Message-ID: <20071001193153.GN3140@inuus.com>
Permalink:  ../20071001193153.GN3140@inuus.com/
Also on:    postgresql.org/message-id/20071001193153.GN3140@inuus.com

 · 

reply

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: lindner@inuus.com, josh@agliodbs.com, heikki@enterprisedb.com, oliver@opencloud.com
  Subject: Re: Prepared Statements vs. pgbouncer
  In-Reply-To: <20071001193153.GN3140@inuus.com>
  References: <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> <47013A0E.6080607@agliodbs.com> <47013ECA.1060400@enterprisedb.com> <4701402A.2020804@agliodbs.com> <20071001193153.GN3140@inuus.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