X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 68E3E9FB24E for ; Thu, 3 Aug 2006 03:05:28 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 37259-01 for ; Thu, 3 Aug 2006 03:05:21 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by postgresql.org (Postfix) with ESMTP id 4978B9FB282 for ; Thu, 3 Aug 2006 03:05:21 -0300 (ADT) Received: from 203-118-178-246.bliink.ihug.co.nz ([203.118.178.246] helo=[10.1.1.6]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1G8WKY-0008Jr-39; Thu, 03 Aug 2006 18:05:14 +1200 Message-ID: <44D19215.1070002@opencloud.com> Date: Thu, 03 Aug 2006 18:05:09 +1200 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.8 (X11/20060502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Csaba Nagy CC: Postgres JDBC Subject: Re: PGStatement#setPrepareThreshold References: <1154529173.21451.27.camel@coppola.muc.ecircle.de> In-Reply-To: <1154529173.21451.27.camel@coppola.muc.ecircle.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200608/9 X-Sequence-Number: 15536 Csaba Nagy wrote: > Hi all, > > Question: will PGStatement.setPrepareThreshold(1) cause server side > prepare to be used already on the first execution, or only after the > second one ? It should cause it to be used on the first execution (at least that was the intent) The logic looks like: - On statement creation set count=0 - On each execution: - If this statement is a PreparedStatement, increment count - If threshold == 0 or count < threshold, make this execution "oneshot" - Execute query "oneshot" queries use the unnamed statement (with one exception: queries that will be backed by a portal use a named statement) > I couldn't figure out this from the log files... postgres logs the > queries as , but that doesn't tell me too much. If you're seeing then those queries aren't using server-side prepare (the unnamed statement is also special as it's the trigger for the planner behaviour that you are trying to avoid..) .. so it seems that you are not managing to trigger server-side prepare for some reason. Maybe you are using a plain Statement? -O