Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id EDF7F9FB5ED; Tue, 6 Mar 2007 19:24:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 24106-06; Tue, 6 Mar 2007 19:24:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 5E6C99FB552; Tue, 6 Mar 2007 19:24:06 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l26NNwPS012576; Tue, 6 Mar 2007 18:23:58 -0500 (EST) To: "Simon Riggs" cc: pgsql-hackers@postgreSQL.org, pgsql-jdbc@postgreSQL.org Subject: Re: Plan invalidation vs. unnamed prepared statements In-reply-to: <1173222262.3760.2171.camel@silverbirch.site> References: <6080.1173201777@sss.pgh.pa.us> <1173222262.3760.2171.camel@silverbirch.site> Comments: In-reply-to "Simon Riggs" message dated "Tue, 06 Mar 2007 23:04:21 +0000" Date: Tue, 06 Mar 2007 18:23:58 -0500 Message-ID: <12575.1173223438@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.06 tagged_above=0 required=5 tests=AWL, BAYES_50, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200703/443 X-Sequence-Number: 99927 "Simon Riggs" writes: > On Tue, 2007-03-06 at 12:22 -0500, Tom Lane wrote: >> A. Just accept the extra overhead, thereby preserving the current >> behavior of unnamed statements, and gaining the benefit that plan >> invalidation will work correctly in the few cases where an unnamed >> statement's plan lasts long enough to need replanning. > With connection pooling, multiple sessions will execute each statement. > If we check the cache each time this does seem more expensive for each > individual session, but we should gain synergy from other similar > sessions. It seems fairly unlikely to me that client code would try to share an unnamed statement across multiple application threads; the entire point is that it's for one-off queries. Or did you miss the point that the plan cache is local per-backend? > ISTM there will be some cases where the current behaviour will not be > maintained if we implement A exactly. One thing I've not seen mentioned > is the effect of constants on various plans. There is none. regards, tom lane