Lukas Smith <[EMAIL PROTECTED]> writes:
> Tom Lane wrote:
>> I think that's the wrong place. transformGroupClause is the right
>> place. It already does some hacking to try to make the GROUP BY
>> semantics match ORDER BY, but it doesn't think to try reordering
>> the GROUP BY items.
> Does it
Tom Lane wrote:
Neil Conway <[EMAIL PROTECTED]> writes:
A simple hack might help with a subset of this problem, though. For
queries with both ORDER BY and GROUP BY clauses, we can sort the
grouping columns according to their position in the ORDER BY list. So,
given a query like:
SELECT a, b,
Neil Conway <[EMAIL PROTECTED]> writes:
> A simple hack might help with a subset of this problem, though. For
> queries with both ORDER BY and GROUP BY clauses, we can sort the
> grouping columns according to their position in the ORDER BY list. So,
> given a query like:
> SELECT a, b, max(c) FROM
The query optimizer currently does not consider reordering a query's
grouping columns. While the order in which ORDER BY columns are
specified affects the semantics of the query, AFAICS GROUP BY's column
order does not. Reordering a query's grouping columns would allow the
optimizer to avoid some u