Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 0805F9FA248 for ; Wed, 20 Dec 2006 17:29:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 01064-09 for ; Wed, 20 Dec 2006 17:28:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from genomemail.chop.edu (genomemail.chop.edu [159.14.214.193]) by postgresql.org (Postfix) with ESMTP id 2CD209FA182 for ; Wed, 20 Dec 2006 17:28:51 -0400 (AST) Received: from [159.14.214.141] ([159.14.214.141]) BY genomemail.chop.edu ([159.14.214.193]) WITH ESMTP (4D WebSTAR V Mail (5.3.4)); Wed, 20 Dec 2006 16:28:50 -0500 Message-ID: <4589AB12.9080703@genome.chop.edu> Date: Wed, 20 Dec 2006 16:28:50 -0500 From: Kevin Murphy User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.8) Gecko/20061025 Thunderbird/1.5.0.8 Mnenhy/0.7.4.666 MIME-Version: 1.0 To: Mark Lewis CC: pgsql-jdbc@postgresql.org Subject: Re: parametrized statements, but always replan? References: <45899296.9040008@genome.chop.edu> <1166647299.7947.124.camel@archimedes> In-Reply-To: <1166647299.7947.124.camel@archimedes> 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: 200612/105 X-Sequence-Number: 16337 Mark Lewis wrote: > Set the prepareThreshold to 0, meaning that it will never create a > "real" server-side prepared statement. Hmm, even by default (without specifying prepareThreshold), it seems that the planner looks at the parameter values for the first execution of the query. (See my post a couple minutes ago*). Am I mistaken? If I'm not mistaken, then for one-shot queries, is there any any additional advantage to setting prepareThreshold to 0? BTW, is the default value of prepareThreshold is 1? Thanks, Kevin Murphy * From my post a couple of minutes ago: > OK, PG definitely plans based on the parameter value. I turned on > plan logging in the server log, and without specifying > prepareThreshold at all (e.g. setting it to 0), I can see that PG is > making different plan [cost] estimates for different parameter values.