Search Postgresql Archives

Re: Multiple Aggregations Order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> wrote:
On Tuesday, January 14, 2020, João Haas <joao.ca.haas@xxxxxxxxx> 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.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux