reorder GROUP BY list

Поиск
Список
Период
Сортировка
От Neil Conway
Тема reorder GROUP BY list
Дата
Msg-id 1141523094.24513.60.camel@localhost.localdomain
обсуждение исходный текст
Ответы Re: reorder GROUP BY list  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
Per recent discussion on -hackers, we should sometimes try to reorder
the columns of the grouping clause to avoid redundant sorts. The
optimizer is not currently capable of doing this, so this patch
implements a simple hack in the analysis phase (transformGroupClause):
if any subset of the GROUP BY clause matches a prefix of the ORDER BY
list, that prefix is moved to the front of the GROUP BY clause. This
shouldn't change the semantics of the query, and allows a redundant sort
to be avoided for queries like "GROUP BY a, b ORDER BY b".

One question about the implementation: to avoid redundant and
potentially expensive calls to findTargetlistEntry(), I constructed a
temporary list of TLEs. I think that's probably a good tradeoff, but
suggestions for improvement are welcome. Also, I released the list via
list_free() when finished with it -- is that a waste of cycles?

Barring any objections, I'll apply this to HEAD tomorrow.

-Neil


Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: LDAP auth
Следующее
От: Tom Lane
Дата:
Сообщение: Re: reorder GROUP BY list