Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 6FBF39F9A4C for ; Tue, 2 Oct 2007 09:40:38 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 23239-01 for ; Tue, 2 Oct 2007 09:40:03 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from depesz.com (depesz.com [88.198.37.40]) by postgresql.org (Postfix) with ESMTP id CE1199F9901 for ; Tue, 2 Oct 2007 09:40:25 -0300 (ADT) Received: from depesz by depesz.com with local (Exim 4.63) (envelope-from ) id 1Ich1K-0000U9-Tk; Tue, 02 Oct 2007 14:38:39 +0200 Date: Tue, 2 Oct 2007 14:38:38 +0200 From: hubert depesz lubaczewski To: Tom Lane Cc: pg@fastcrypt.com, Josh Berkus , Heikki Linnakangas , lindner@inuus.com, Oliver Jowett , pgsql-jdbc@postgresql.org Subject: Re: Prepared Statements vs. pgbouncer Message-ID: <20071002123838.GA1462@depesz.com> Reply-To: depesz@depesz.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> <47013E0F.8050508@fastcrypt.com> <19675.1191264250@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <19675.1191264250@sss.pgh.pa.us> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/33 X-Sequence-Number: 17605 On Mon, Oct 01, 2007 at 02:44:10PM -0400, Tom Lane wrote: > Dave Cramer writes: > > Josh Berkus wrote: > >> So where is it going to be easier to fix this ... pgBouncer, or pg-JDBC? > > pgBouncer is broken so I'd fix it. > It's an enormous mistake to imagine that prepared statements are the > only issue. What about GUC settings and temp tables, to mention a > couple other bits of per-session state? i think that calling it broken is "a bit" far fetched. i dont know how familiar you are with pgbouncer, but the mode in which paul ran pgbouncer is *purposedly* not working correctly with prepared statement.s basically - ppgbouncer supports 3 modes: - session pooling - transaction pooling - statement pooling. description of all of them is clear in manual: ------------------------------ Session pooling:: Most polite method. When client connects, a server connection will be assigned to it for the whole duration it stays connected. When client disconnects, the server connection will be put back into pool. Transaction pooling:: Server connection is assigned to client only during a transaction. When PgBouncer notices that transaction is over, the server will be put back into pool. Statement pooling:: Most aggressive method. The server connection will be put back into pool immidiately after a query completes. Multi-statement transactions are disallowed in this mode as they would break. ------------------------------ so, pgbouncer is not broken. if you want to keep your connection between transactions (which is perfectly sensible) - use session pooling. both transaction pooling and statement pooling are modes which trade some performance for missing features. i wouldn't suggest anyone using statement pooling, but if i would use it, then what right do i have to complain about bad transactions?! best regards, depesz -- quicksil1er: "postgres is excellent, but like any DB it requires a highly paid DBA. here's my CV!" :) http://www.depesz.com/ - blog dla ciebie (i moje CV)