From: Josh Berkus <josh@agliodbs.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: Bad cost estimate with FALSE filter condition
Date: Mon, 16 Mar 2015 12:12:15 -0700
Message-ID: <55072B0F.5090104@agliodbs.com> (raw)
In-Reply-To: <WM!6babb4d033880b07aae2574ccbabb8dcad1de57fc7cfbc814982741137ab36ed5a9cb79a4401ae73ee971b0ae8e5c760!@asav-3.01.com>
References: <54F119A6.9080106@agliodbs.com>
<WM!4d936314dc9313889ef2e5e6a4381fd285d187be51c5b5de339e449728769003a8062a9992b607935e468812a6b9b787!@asav-3.01.com>
<55070FC9.4010307@agliodbs.com>
<4345.1426530415@sss.pgh.pa.us>
<WM!6babb4d033880b07aae2574ccbabb8dcad1de57fc7cfbc814982741137ab36ed5a9cb79a4401ae73ee971b0ae8e5c760!@asav-3.01.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
On 03/16/2015 11:26 AM, Tom Lane wrote:
> Josh Berkus <josh@agliodbs.com> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: josh@agliodbs.com, tgl@sss.pgh.pa.us
Subject: Re: Bad cost estimate with FALSE filter condition
In-Reply-To: <55072B0F.5090104@agliodbs.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox