Multiple Aggregations Order

2020-01-14 Thread João Haas
Hi there, I'm working on a query where I need to fetch information from a table along with some data from a many-to-many connection table in a single query. My idea is to do an outer join with the connection query and aggregate the needed data in multiple 'array_agg's, and then handle this aggrega

Re: Multiple Aggregations Order

2020-01-14 Thread João Haas
I'm aiming to serialize some graph data into a JSON format, and some of the data needed for the serialization is in the relation tables, like, "this node connects to this other node in this way". These are served to IOT devices and the data changes a lot, so there's a ton of requests and caching is

Re: Multiple Aggregations Order

2020-01-14 Thread João Haas
Johnston < david.g.johns...@gmail.com> wrote: > On Tuesday, January 14, 2020, João Haas 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 “...