pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Dilger <hornschnorter@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David Rowley <david.rowley@2ndquadrant.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: Parallel Aggregates for string_agg and array_agg
Date: Tue, 1 May 2018 14:35:46 -0700
Message-ID: <ADEC5025-2BD4-42C8-B63F-004D89EEE8D4@gmail.com> (raw)
In-Reply-To: <20180501211147.3balprbggw3pdpxk@alap3.anarazel.de>
References: <CAKJS1f-Qcv2FiUHKCS_2OT3Gb3bOW_yZw9mKSCj=SDwYMH85hA@mail.gmail.com>
	<20180327002617.fjgkgxmeojfkti7b@alvherre.pgsql>
	<CAKJS1f-1zxwY9-jWwdB47+24NwbUzgWAOAGhECnvQKSDXRP_wg@mail.gmail.com>
	<13700.1522162694@sss.pgh.pa.us>
	<1C2959D0-56F2-4067-B2AC-DF9A3B1D0FB5@gmail.com>
	<20180501211147.3balprbggw3pdpxk@alap3.anarazel.de>


> On May 1, 2018, at 2:11 PM, Andres Freund <andres@anarazel.de> wrote:
> 
> Hi,
> 
> 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?

I was responding in part to Tom's upthread statement:

  Your own example of assuming that separate aggregates are computed
  in the same order reinforces my point, I think.  In principle, anybody
  who's doing that should write

      array_agg(e order by x),
      array_agg(f order by x),
      string_agg(g order by x)

  because otherwise they shouldn't assume that;

It seems Tom is saying that you can't assume separate aggregates will be
computed in the same order.  Hence my response.  What am I missing here?

mark 





view thread (77+ messages)  latest in thread

Message-ID: <ADEC5025-2BD4-42C8-B63F-004D89EEE8D4@gmail.com>
Permalink:  ../ADEC5025-2BD4-42C8-B63F-004D89EEE8D4@gmail.com/
Also on:    postgresql.org/message-id/ADEC5025-2BD4-42C8-B63F-004D89EEE8D4@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: hornschnorter@gmail.com, andres@anarazel.de, tgl@sss.pgh.pa.us, david.rowley@2ndquadrant.com, alvherre@alvh.no-ip.org, sfrost@snowman.net, tomas.vondra@2ndquadrant.com
  Subject: Re: Parallel Aggregates for string_agg and array_agg
  In-Reply-To: <ADEC5025-2BD4-42C8-B63F-004D89EEE8D4@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox