On 2015-06-09 17:19:33 +0200, Tomas Vondra wrote: > ... and yet another use case for 'aggregate state combine' that I just > remembered about is grouping sets. What GROUPING SET (ROLLUP, ...) do > currently is repeatedly sorting the input, once for each grouping.
Actually, that's not really what happens. All aggregates that share a sort order are computed in parallel. Only when sets do not share an order additional sorts are required. > What > could happen in some cases is building the most detailed aggregation first, > then repeatedly combine these partial states. I'm not sure that'll routinely be beneficial, because it'd require keeping track of all the individual "most detailed" results, no? Greetings, Andres Freund -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers