Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 4FD939F9E03 for ; Mon, 1 Oct 2007 05:27:04 -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 31008-07 for ; Mon, 1 Oct 2007 05:26:45 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from tremor.opencloud.co.nz (tremor.opencloud.co.nz [131.203.101.230]) by postgresql.org (Postfix) with ESMTP id 990229F9A97 for ; Mon, 1 Oct 2007 05:26:54 -0300 (ADT) Received: from 222-154-155-16.jetstream.xtra.co.nz ([222.154.155.16] helo=[10.1.1.3]) by tremor.opencloud.co.nz with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1IcGc4-0001fq-5C; Mon, 01 Oct 2007 21:26:48 +1300 Message-ID: <4700AF4A.4020105@opencloud.com> Date: Mon, 01 Oct 2007 21:26:50 +1300 From: Oliver Jowett User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Paul Lindner CC: Gregory Stark , pgsql-jdbc@postgresql.org Subject: Re: Prepared Statements vs. pgbouncer References: <20070929002513.GG3140@inuus.com> <87sl4xvmn2.fsf@oxford.xeocode.com> <20070929144635.GK3140@inuus.com> <46FED6A2.8000209@opencloud.com> <20070930070725.GL3140@inuus.com> <46FF4C08.2090608@opencloud.com> <20071001081720.GM3140@inuus.com> In-Reply-To: <20071001081720.GM3140@inuus.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/4 X-Sequence-Number: 17576 Paul Lindner wrote: > 2) Before preparing a statement with a hashed name, send a close > statement to insure that we don't get an error inside of a > transaction. But that defeats the purpose of using a named statement in the first place -- and any potential benefit you'd get by sharing statements between clients -- if you're going to throw it away before reusing it every time! > This is just as performant as the current driver which will happily > re-prepare the same SQL many times. No. The current driver will switch to a named statement that is prepared *once* when it thinks there is a benefit to doing so (tunable via prepareThreshold). Your change would mean that it would always re-prepare statements. Unless you're talking about a statement cache so that applications don't have to hold onto a particular PreparedStatement object to get the benefit of reuse, which arguably is the responsibility of the appserver (see the list archives for recent discussion of this). > I do hope that you'll find any work done > useful for general consumption. Unfortunately, I still don't really see any these solutions to your particular problem as something that'd be useful in the general driver. I think your efforts would be better spent in teaching pgbouncer to deal with named statements properly.. -O