| От | Neil Conway |
|---|---|
| Тема | reorder GROUP BY list |
| Дата | |
| Msg-id | 1141523094.24513.60.camel@localhost.localdomain обсуждение исходный текст |
| Ответы |
Re: reorder GROUP BY list
|
| Список | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера