Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 009552E01B6 for ; Thu, 10 Jan 2008 08:12:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 22628-04 for ; Thu, 10 Jan 2008 08:12:04 -0400 (AST) Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.234]) by postgresql.org (Postfix) with ESMTP id 0D4F62E0157 for ; Thu, 10 Jan 2008 08:12:04 -0400 (AST) Received: by wx-out-0506.google.com with SMTP id r21so335720wxc.28 for ; Thu, 10 Jan 2008 04:12:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=ypZ6VR49owwYxeQ1P75N4MgzH1I6iwzwnDEkRoB5O1Q=; b=hGyu4jg7juLK/kEiCqc8l0URLAI7IqYWUTRr6PzD3kHJtMt98inMUJryguljBV3Nu3k1NG473ZisDOzzEBUOtXfpT/n9yPu4G9DT6Y5AAawkG1+NqfDaiJ5Drg8PcCxuPwZAxIaAdZv6QDAHsX8HyGIhHN7k3jbp9FMRPYpMcl0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=xfUsmf2j3Ag22mcyWXMOk6NSv6YKY/MKyqJtOoqANc1Z2wZqYB1nDaVc51sU4Lf6YfJ5nWLXMtWjluCge9gYp9QS+46jf+1A/C82ea5uB5lBauqpPuJW4co/hwVwQ4lHg7MVHI5xr8fzm5tZsvwL02sw2DZDJ5FNKIDrQ99GjOs= Received: by 10.142.171.6 with SMTP id t6mr852964wfe.126.1199967123284; Thu, 10 Jan 2008 04:12:03 -0800 (PST) Received: by 10.142.214.8 with HTTP; Thu, 10 Jan 2008 04:12:03 -0800 (PST) Message-ID: <6b9e1eb20801100412w6f951dd6y9de1e39a0c5805a8@mail.gmail.com> Date: Thu, 10 Jan 2008 13:12:03 +0100 From: "Isak Hansen" To: "mljv@planwerk6.de" Subject: Re: Prepared Statements Cc: "Kris Jurka" , pgsql-general@postgresql.org In-Reply-To: <200801101153.38782.mljv@planwerk6.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200801092002.15417.mljv@planwerk6.de> <200801101153.38782.mljv@planwerk6.de> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/449 X-Sequence-Number: 126659 On 1/10/08, mljv@planwerk6.de wrote: > > > > > > I have not found anything about preparing "unnamed" statements. What > > > does it mean? > > > > Unnamed statements are what the driver uses before it hits the > > prepareThreshold limit. Once it has determined the statement will be > > reused many times it changes to a named statement that has a longer > > lifespan. > > What do you mean with "longer lifespan"? Doesn't the JDBC driver uses the > PREPARE Sql Statement and therefore the prepared Statement has the same > lifespan as the connection? If so, as connections are pooled and never > closed, the prepared Statement will last forever. What if the table analyzes > changes and a better execution plan could be found? > An unnamed prepared query is just a normal one-shot query, but it allows the use of bind variables. You'll find more details in the protocol section of the postgres docs . Regards, Isak