Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 054AE9FB975; Tue, 6 Mar 2007 14:04:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 88528-04; Tue, 6 Mar 2007 14:04:11 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from stark.xeocode.com (unknown [87.127.95.194]) by postgresql.org (Postfix) with ESMTP id 44B309FBA1B; Tue, 6 Mar 2007 14:04:07 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with esmtp (Exim 4.63) (envelope-from ) id 1HOe1J-0008KZ-2w; Tue, 06 Mar 2007 18:04:17 +0000 From: Gregory Stark To: "Tom Lane" Cc: , Subject: Re: Plan invalidation vs. unnamed prepared statements In-Reply-To: <6080.1173201777@sss.pgh.pa.us> (Tom Lane's message of "Tue, 06 Mar 2007 12:22:57 -0500") Organization: EnterpriseDB References: <6080.1173201777@sss.pgh.pa.us> X-Draft-From: ("nnimap+mail01.enterprisedb.com:INBOX" 9527) Date: Tue, 06 Mar 2007 18:04:16 +0000 Message-ID: <87fy8i9rkv.fsf@stark.xeocode.com> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.143 tagged_above=0 required=5 tests=AWL, BAYES_50, FORGED_RCVD_HELO, SPF_SOFTFAIL X-Spam-Level: * X-Archive-Number: 200703/419 X-Sequence-Number: 99903 "Tom Lane" writes: > B. Don't store the unnamed statement in the plan cache. To make sure > it's not used anymore when the plan might be stale, forcibly discard > the unnamed statement after execution. This would get rid of a lot > of overhead but would mean a significant change in the protocol-level > behavior. It's hard to guess how many clients might be broken by it > --- conceivably not any, but that seems too optimistic :-( Can we forcibly discard it if *any* messages are received that might invalidate a plan? So basically it would work fine unless anyone in the system does any DDL at all? I guess that has the downside of introducing random unpredictable failures. Or stash the query string and replan it (possibly in the query cache this time) if someone executes it a second time? Can't say I like either of those options much, just trying to brainstorm. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com