Re: [HACKERS] column order in GROUP BY

2006-03-03 Thread Tom Lane
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

Re: [HACKERS] column order in GROUP BY

2006-03-03 Thread Lukas Smith
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,

Re: [HACKERS] column order in GROUP BY

2006-03-02 Thread Tom Lane
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

[HACKERS] column order in GROUP BY

2006-03-02 Thread Neil Conway
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