Re: EXISTS clauses not being optimized in the face of 'one time pass' optimizable expressions

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: EXISTS clauses not being optimized in the face of 'one time pass' optimizable expressions
Дата
Msg-id CA+TgmoYBnWuJbEasHODB3WPmheW+ypWxUYzT=ugnQCqg9bmFKA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: EXISTS clauses not being optimized in the face of 'one time pass' optimizable expressions  (Merlin Moncure <mmoncure@gmail.com>)
Ответы Re: EXISTS clauses not being optimized in the face of 'one time pass' optimizable expressions  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-hackers
On Fri, Jul 1, 2016 at 10:20 AM, Merlin Moncure <mmoncure@gmail.com> wrote:
> Yeah.  Also, even if you could parse out those cases, it's major
> optimization fence.  Consider if you have an ORDER BY clause here:
>
> SELECT FROM foo WHERE a OR b ORDER BY c;
>
> ... by pushing inside a union, you're going to be in trouble in real
> world cases.  That's just a mess and it would add a lot of runtime
> analysis of the alternative paths.  It's hard for me to believe
> rewriting is easier and simpler than rewriting 'false OR x' to 'x'.  I
> also thing that constant folding strategies are going to render much
> more sensible output to EXPLAIN.

I don't think that it's easier and simpler and didn't intend to say
otherwise.  I do think that I've run across LOTS of queries over the
years where rewriting OR using UNION ALL was a lot faster, and I think
that case is more likely to occur in practice than FALSE OR WHATEVER.
But, I'm just throwing out opinions to see what sticks here; I'm not
deeply invested in this.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: EXISTS clauses not being optimized in the face of 'one time pass' optimizable expressions
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Postgres_fdw join pushdown - wrong results with whole-row reference