Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YXaR6-0004Cp-RJ for pgsql-performance@arkaria.postgresql.org; Mon, 16 Mar 2015 19:12:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YXaR5-0006oZ-Rc for pgsql-performance@arkaria.postgresql.org; Mon, 16 Mar 2015 19:12:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YXaR4-0006oS-N8 for pgsql-performance@postgresql.org; Mon, 16 Mar 2015 19:12:22 +0000 Received: from mx-out.zmailcloud.com ([192.198.85.98] helo=mx-out-1.zmailcloud.com) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YXaR0-0004Bm-EV for pgsql-performance@postgresql.org; Mon, 16 Mar 2015 19:12:21 +0000 Received: from smtp.01.com (smtp.01.com [10.10.0.43]) by mx-out-1.zmailcloud.com (Postfix) with ESMTP id 32DA856433A; Mon, 16 Mar 2015 14:12:17 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 2EFB3601A6; Mon, 16 Mar 2015 14:12:17 -0500 (CDT) X-Virus-Scanned: amavisd-new at smtp-out-2.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-2.01.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Gb5RBXXil746; Mon, 16 Mar 2015 14:12:17 -0500 (CDT) Received: from smtp.01.com (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 0F3536025E; Mon, 16 Mar 2015 14:12:17 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id EC9CC601A6; Mon, 16 Mar 2015 14:12:16 -0500 (CDT) X-Virus-Scanned: amavisd-new at smtp-out-2.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-2.01.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id be4WPdS0AY0l; Mon, 16 Mar 2015 14:12:16 -0500 (CDT) Received: from [172.47.23.102] (50-0-89-53.dsl.dynamic.fusionbroadband.com [50.0.89.53]) by smtp-out-2.01.com (Postfix) with ESMTPSA id 708F4601EB; Mon, 16 Mar 2015 14:12:16 -0500 (CDT) Message-ID: <55072B0F.5090104@agliodbs.com> Date: Mon, 16 Mar 2015 12:12:15 -0700 From: Josh Berkus Organization: PostgreSQL Experts Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Tom Lane CC: pgsql-performance@postgresql.org Subject: Re: Bad cost estimate with FALSE filter condition References: <54F119A6.9080106@agliodbs.com> <55070FC9.4010307@agliodbs.com> <4345.1426530415@sss.pgh.pa.us> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 03/16/2015 11:26 AM, Tom Lane wrote: > Josh Berkus writes: >> So ... should I assume my diagnosis is correct? Haven't heard any other >> suggestions. > > I don't see any reason to think this is worth worrying about, or worth > spending planner cycles on to produce a cosmetically nicer cost estimate. I wouldn't say it's critical, but there's two issues: 1) users are confused when they see the plan, especially if it's chosen in preference to a lower-cost plan. It's counter-intuitive for EXPLAIN to not display the "real" estimated cost. 2) Tools which attempt to do some kind of useful aggregation or event handling around estimated plan cost have to write special workarounds for these cases. Is there anything *useful* about the existing behavior such that we'd like to preserve it? Or is it just a matter of Nobody's Submitted A Patch Yet? I ask because I'm thinking about a patch, so if changing this will break a lot of stuff, that's a good thing to know. > One-time filters always apply at the top plan level so they're unlikely > to change any planner choices. Moreover, for any case other than the > not-terribly-interesting constant FALSE case, we're better off assuming > that the filter condition will be true (and so there's nothing to adjust). Except that we *don't* get back the same estimate for a TRUE filter condition. -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance