| От | Tom Lane |
|---|---|
| Тема | Re: Slow performance with Group By |
| Дата | |
| Msg-id | 12781.1099961764@sss.pgh.pa.us обсуждение |
| Ответ на | Slow performance with Group By (Erik Norvelle <signups@norvelle.org>) |
| Список | pgsql-performance |
Erik Norvelle <signups@norvelle.org> writes:
>>> it=> explain select codelemm, sectref, count(codelemm) from indethom
> group by codelemm, sectref;
>>> QUERY PLAN
>>> -----------------------------------------------------------------------
> ---------
>>> GroupAggregate (cost=2339900.60..2444149.44 rows=1790528 width=13)
>>> -> Sort (cost=2339900.60..2364843.73 rows=9977252 width=13)
>>> Sort Key: codelemm, sectref
>>> -> Seq Scan on indethom (cost=0.00..455264.52 rows=9977252
> width=13)
Actually the painful part of that is the sort. If you bump up sort_mem
enough it will eventually switch over to a HashAggregate with no sort,
which may be a better plan if there's not too many groups (is the
estimate of 1.79 million on the mark at all??)
regards, tom lane
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера