Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id B04532E0139 for ; Sat, 12 Jan 2008 19:47:03 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 36452-01 for ; Sat, 12 Jan 2008 19:46:59 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id EA2CC2E0134 for ; Sat, 12 Jan 2008 19:46:58 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id m0CNkop1024035; Sat, 12 Jan 2008 18:46:50 -0500 (EST) To: Kris Jurka cc: mljv@planwerk6.de, pgsql-general@postgresql.org Subject: Re: Prepared Statements In-reply-to: References: <200801092002.15417.mljv@planwerk6.de> <200801101153.38782.mljv@planwerk6.de> Comments: In-reply-to Kris Jurka message dated "Sat, 12 Jan 2008 17:04:41 -0500" Date: Sat, 12 Jan 2008 18:46:50 -0500 Message-ID: <24034.1200181610@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/596 X-Sequence-Number: 126804 Kris Jurka writes: > On Thu, 10 Jan 2008, mljv@planwerk6.de wrote: >> 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? > Data and stats changes do not trigger a replan. Note that this is no longer true as of 8.3: a stats update from ANALYZE (either manual or autovacuum) will trigger invalidation of cached plans. regards, tom lane