Re: Using GROUPING SETS with more than one set disables predicate pushdown?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Zakhar Shapurau <zak@xxxxxx> writes:
> Using GROUPING SETS with more than one set disables predicate pushdown?

It looks like this is a case that no one's gotten round to yet.
The comment in the relevant code is

     * In some cases we may want to transfer a HAVING clause into WHERE. We
     * cannot do so if the HAVING clause contains aggregates (obviously) or
     * volatile functions (since a HAVING clause is supposed to be executed
     * only once per group).  We also can't do this if there are any nonempty
     * grouping sets; moving such a clause into WHERE would potentially change
     * the results, if any referenced column isn't present in all the grouping
     * sets.  (If there are only empty grouping sets, then the HAVING clause
     * must be degenerate as discussed below.)

Presumably, we could examine the grouping sets to identify column(s)
present in all sets, and then allow the optimization for clauses that
reference only such columns.  Or maybe I'm misreading the comment
(but then it needs clarification).

			regards, tom lane




[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux