Re: Parallel Aggregates for string_agg and array_agg - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Parallel Aggregates for string_agg and array_agg
Date
Msg-id 16902.1525209376@sss.pgh.pa.us
Whole thread Raw
In response to Re: Parallel Aggregates for string_agg and array_agg  (Andres Freund <andres@anarazel.de>)
Responses Re: Parallel Aggregates for string_agg and array_agg  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2018-05-01 14:09:39 -0700, Mark Dilger wrote:
>> I don't care which order the data is in, as long as x[i] and y[i] are
>> matched correctly.  It sounds like this patch would force me to write
>> that as, for example:
>> 
>> select array_agg(a order by a, b) AS x, array_agg(b order by a, b) AS y
>> from generate_a_b_func(foo);
>> 
>> which I did not need to do before.

> Why would it require that? Rows are still processed row-by-row even if
> there's parallelism, no?

Yeah, as long as we distribute all the aggregates in the same way,
it seems like they'd all see the same random-ish input ordering.
I can vaguely conceive of future optimizations that might break
that, but not what we have today.

            regards, tom lane


pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Should we add GUCs to allow partition pruning to be disabled?
Next
From: Andres Freund
Date:
Subject: Re: Parallel Aggregates for string_agg and array_agg