Re: Bad cost estimate with FALSE filter condition

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Bad cost estimate with FALSE filter condition
Дата
Msg-id 55072B0F.5090104@agliodbs.com
обсуждение исходный текст
Ответ на Bad cost estimate with FALSE filter condition  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-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


В списке pgsql-performance по дате отправления:

Предыдущее
От: Vivekanand Joshi
Дата:
Сообщение: Re: Performance issues
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: EXPLAIN (no ANALYZE) taking an hour for INSERT FROM SELECT