Re: Multiple Aggregations Order

Поиск
Список
Период
Сортировка
От João Haas
Тема Re: Multiple Aggregations Order
Дата
Msg-id CAEi5ktJe0W1fTX2Xo97+xCAhU8=TBqDQx4VwM0vqvH8CNLOURg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Multiple Aggregations Order  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
I also thought about that. The 'issue', is that when you call array_agg in a row/type, it casts the entire thing in a string. But some of the aggregation fields are jsonb fields, which are also casted to strings, with extra escapes. Then, I'm also using Django, which seems to mess the string even more. I could try to denormalize this whole mess, but I don't think the overhead of sorting each agg is enough for this. Also, Django handles these extra fields really well on raw queries, so it's not an issue having a lot of fields.

On Tue, Jan 14, 2020 at 5:43 PM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Tuesday, January 14, 2020, João Haas <joao.ca.haas@gmail.com> wrote:
SELECT tb.*, array_agg(conn.child_id), array_agg(conn.kind)


Create a custom type (using row(...) might work...?) with the relevant fields and “...array_agg((child_id, kind)::custom_type order by ...”?

David J.

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

Предыдущее
От: João Haas
Дата:
Сообщение: Re: Multiple Aggregations Order
Следующее
От: Thomas Kellerer
Дата:
Сообщение: Re: Multiple Aggregations Order