I've changed the code to use order by in the aggregate and it seems
there are no noticeable changes in the query performance.
Thanks for the help.
Best,
Federico Caselli
On Sun, 25 Sept 2022 at 00:30, Federico wrote:
>
> Understood, thanks for the explanation.
> I'll work on updating the queries
Understood, thanks for the explanation.
I'll work on updating the queries used by sqlalchemy to do array_agg(x
order by x) instead of the order by in the subquery.
> I think that right now that'd
> incur additional sorting overhead, which is annoying. But work is
> ongoing to recognize when the i
Federico writes:
> A basic example of the type of query in question is the following (see
> below for the actual query):
> select w, array_agg(x)
> from (
> select v, v / 10 as w
> from pg_catalog.generate_series(25, 0, -1) as t(v)
> order by v
> ) as t(x)
> group by w
> This
Hi all,
I have a question related to the order by clause used in a subquery of
a main query that uses one or more aggregation functions with a group
by.
A basic example of the type of query in question is the following (see
below for the actual query):
select w, array_agg(x)
from (
select