Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 3094A9F9CE8 for ; Sat, 29 Sep 2007 11:46:52 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 50789-05 for ; Sat, 29 Sep 2007 11:46:48 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mirth.inuus.com (mirth.inuus.com [67.100.95.85]) by postgresql.org (Postfix) with ESMTP id CB3F99F9C9A for ; Sat, 29 Sep 2007 11:46:47 -0300 (ADT) Received: from mirth.inuus.com (localhost.localdomain [127.0.0.1]) by mirth.inuus.com (8.14.1/8.14.1) with ESMTP id l8TEkZnA018671 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 29 Sep 2007 07:46:35 -0700 Received: (from lindner@localhost) by mirth.inuus.com (8.14.1/8.14.1/Submit) id l8TEkZaY018670; Sat, 29 Sep 2007 07:46:35 -0700 X-Authentication-Warning: mirth.inuus.com: lindner set sender to lindner@inuus.com using -f Date: Sat, 29 Sep 2007 07:46:35 -0700 From: Paul Lindner To: Gregory Stark Cc: Paul Lindner , pgsql-jdbc@postgresql.org Subject: Re: Prepared Statements vs. pgbouncer Message-ID: <20070929144635.GK3140@inuus.com> References: <20070929002513.GG3140@inuus.com> <87sl4xvmn2.fsf@oxford.xeocode.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2WS97oupGEGbYNpW" Content-Disposition: inline In-Reply-To: <87sl4xvmn2.fsf@oxford.xeocode.com> User-Agent: Mutt/1.5.14 (2007-02-12) X-Virus-Scanned: ClamAV 0.91.2/4426/Fri Sep 28 22:28:01 2007 on mirth.inuus.com X-Virus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/143 X-Sequence-Number: 17565 --2WS97oupGEGbYNpW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 29, 2007 at 10:36:33AM +0100, Gregory Stark wrote: >=20 > "Paul Lindner" writes: >=20 > > * pgbouncer notices that client A is idle and reassigns backend to=20 > > client B >=20 > What do you mean by "notices"?=20 Okay, I wasn't being clear. In pgbouncer at the END of a commit the backend will be put into the idle pool. Please read the following: https://developer.skype.com/SkypeGarage/DbProjects/PgBouncer > Prepared statements are only one form of state which can persist beyond a > transaction end. I don't think you can reassign connections unless you get > some sort of explicit notice that the client is done with any state it ha= s set > up. Either the driver supports noticing such a state because there are no > active references to its handle or the client issues a statement like RES= ET > ALL or something equivalent. Okay. How do we fix this? Short term? Long term? For this specific case a long term fix might involve transaction-scoped prepared statements. Of course that would require adding this feature on many levels. Should middleware products track all prepared statements and re-send those to each backend? What happens when you have collisions between names? Should auto-generated prepared statements use a common hashing method to insure that we don't recreate the same prepared statement over and over? --=20 Paul Lindner ||||| | | | | | | | | | lindner@inuus.com --2WS97oupGEGbYNpW Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFG/mVK+FkoUnP1gFQRAj8VAKChC4bv/+poWBM7qBXEZZh7tD2wTgCePACR EWqhyCH1tPdBBCg+As0LGRA= =aV07 -----END PGP SIGNATURE----- --2WS97oupGEGbYNpW--