Re: array_agg() does not stop aggregating according to HAVING clause
В списке pgsql-general по дате отправления:
| От | Dimitrios Apostolou |
|---|---|
| Тема | Re: array_agg() does not stop aggregating according to HAVING clause |
| Дата | |
| Msg-id | 3f255b39-e0a7-e04e-0747-c98b13a4e0f6@gmx.net обсуждение |
| Ответ на | Re: array_agg() does not stop aggregating according to HAVING clause (Tom Lane <tgl@sss.pgh.pa.us>) |
| Список | pgsql-general |
On Sat, 17 Aug 2024, Tom Lane wrote: > Well, yes: the two aggregates (array_agg and count) are computed > concurrently in a single Aggregate plan node scanning the output > of the JOIN. There's no way to apply the HAVING filter until > after the aggregation is finished. > > I think this approach is basically forced by the SQL standard's > semantics for grouping/aggregation. FWIW I also tried: HAVING array_length(array_agg(run_n), 1) < 10; but I saw the same amount of temp files, at least in the short duration of my test run. Thank you, I will split this into two passes like you suggested. It's just that I'm doing another 3 passes over this table for different things I calculate (different GROUP BY, different WHERE clauses) and I was hoping to minimize the time spent. But avoiding the array_agg() over everything is my top priority ATM so I'll definitely try. Regards, Dimitris
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера