Re: Optimizer Doesn't Push Down Where Expressions on Rollups

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Optimizer Doesn't Push Down Where Expressions on Rollups
Дата
Msg-id 2865.1583935603@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Optimizer Doesn't Push Down Where Expressions on Rollups  (Richard Guo <guofenglinux@gmail.com>)
Ответы Re: Optimizer Doesn't Push Down Where Expressions on Rollups  (Logan Bowers <logan.bowers@gmail.com>)
Re: Optimizer Doesn't Push Down Where Expressions on Rollups  (Richard Guo <guofenglinux@gmail.com>)
Список pgsql-bugs
Richard Guo <guofenglinux@gmail.com> writes:
> In your case, the WHERE clauses would get pushed down into the subquery
> for both queries, with/without the ROLLUP. But since the subquery uses
> grouping/grouping sets, the WHERE clauses would be put in HAVING of the
> subquery.

Right, we do successfully push the clauses into HAVING of the subquery.

> Then when we plan for the subquery, we will decide whether a HAVING
> clause can be transfered into WHERE. Usually we do not do that if there
> are any nonempty grouping sets. Because if any referenced column isn't
> present in all the grouping sets, moving such a clause into WHERE would
> potentially change the results.

Yeah.  I think that it might be safe if the proposed clause can
be proven strict for (some subset of?) the grouping columns, because
that would eliminate the rollup grouping sets where those columns
come out NULL because they aren't being grouped on.  (This could then
also factor into throwing away those grouping sets, perhaps.)

Anyway, this is not a bug; it's a proposed planner improvement, and
not a trivial one.

            regards, tom lane



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

Предыдущее
От: James Coleman
Дата:
Сообщение: Re: BUG #16280: dead tuples (probably) effect plan and query performance
Следующее
От: Logan Bowers
Дата:
Сообщение: Re: Optimizer Doesn't Push Down Where Expressions on Rollups