Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 33EFE9FA2E3 for ; Mon, 1 Oct 2007 17:49:43 -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 77407-04 for ; Mon, 1 Oct 2007 17:49:40 -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 C3ED19FA2DB for ; Mon, 1 Oct 2007 17:49:39 -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 l91KnMXq014165 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 1 Oct 2007 13:49:22 -0700 Received: (from lindner@localhost) by mirth.inuus.com (8.14.1/8.14.1/Submit) id l91KnH98014164; Mon, 1 Oct 2007 13:49:17 -0700 X-Authentication-Warning: mirth.inuus.com: lindner set sender to lindner@inuus.com using -f Date: Mon, 1 Oct 2007 13:49:17 -0700 From: Paul Lindner To: Till Toenges Cc: pgsql-jdbc@postgresql.org Subject: Re: Prepared Statements vs. pgbouncer Message-ID: <20071001204917.GP3140@inuus.com> References: <20070929002513.GG3140@inuus.com> <87sl4xvmn2.fsf@oxford.xeocode.com> <20070929144635.GK3140@inuus.com> <46FED6A2.8000209@opencloud.com> <20070930070725.GL3140@inuus.com> <470125E2.9060505@kyon.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="QAdlk5ze2izLk3Ap" Content-Disposition: inline In-Reply-To: <470125E2.9060505@kyon.de> User-Agent: Mutt/1.5.14 (2007-02-12) X-Virus-Scanned: ClamAV 0.91.2/4445/Mon Oct 1 01:32:46 2007 on mirth.inuus.com X-Virus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/23 X-Sequence-Number: 17595 --QAdlk5ze2izLk3Ap Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 01, 2007 at 06:52:50PM +0200, Till Toenges wrote: > Paul Lindner wrote: > >1) Use hashing to choose a prepared statement name > > > > If we take the hash of the prepared statement text and prefix with > > S_ we can be assured of using the same unique prepared statement > > name across all application servers. > > > > (And yes, I know that hashes are not perfect and collisions can > > occur. Highly unlikely if we choose a good hash) >=20 > This sounds like a bad idea on many levels. Don't do it. Actually, i=20 > think the driver is ok and the real problem is pgbouncer. Actually the problem is that Postgres is process/session oriented in a multithreaded event-based world. > I have another solution to your problem: >=20 > You said that there are 100s of Servers, i assume that there is some=20 > money behind that. Talk to the pgbouncer developers. Ask them to analyze= =20 > your problem and what it would cost to fix it. Ask them what it would=20 > cost to make pgbouncer fully compliant, because it's probably not the=20 > only feature you will miss. Figure out if this is cheaper than replacing= =20 > / upgrading your hardware with something powerful enough to handle the=20 > load without pgbouncer. Pick the cheaper solution. Done. The problem is that the described solution puts way too much moving parts inside of something that should be very simple. You'd have to recreate most of Postgresql's parsing and grammar inside of Pgbouncer and change it from something simple into a full-featured proxy. In my opinion the _correct_ way to fix the problem of too many bloated idle backends is to incorporate libevent into Postgres and radically rethink of ways to maintain cache/session coherence. > "Fixing" the jdbc driver is probably not a stable long term solution,=20 > even if it helps with your most immediate problem. Fixing the JDBC driver is the simplest and cheapest alternative. So I am following your advice and picking the cheaper solution :) --=20 Paul Lindner ||||| | | | | | | | | | lindner@inuus.com --QAdlk5ze2izLk3Ap Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFHAV1N+FkoUnP1gFQRAreDAJ94t4C0m8SdhxUeL+ysqmLaL1qDnACaA4/d /rVu5f5cZMcWK7rmUpFk/2Y= =leNs -----END PGP SIGNATURE----- --QAdlk5ze2izLk3Ap--