Re: Combining Aggregates - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Combining Aggregates
Date
Msg-id 54ECCDE7.1070509@gmx.net
Whole thread Raw
In response to Re: Combining Aggregates  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Responses Re: Combining Aggregates  (David Rowley <dgrowleyml@gmail.com>)
List pgsql-hackers
On 2/20/15 3:32 PM, Tomas Vondra wrote:
>> That's just because the count is hidden there in an opaque custom 
>> transition function. If, say, we had instead an array of transition 
>> functions {inc, plus, plussq} and we knew that plus and plussq are 
>> associative operators, all we'd need to special case is the count
>> case. This would avoid a lot of repetitive code for stddev, avg, etc.
> 
> Ummm, I'm not entirely sure I understand that, but the main point was
> that the current implementation does not work like that. We have no idea
> what transition functions are transitive, and we do have opaque
> aggregate states.

Well, my point is that you could make it work that way and make your
current patch a lot smaller and simpler.

> Also, there are aggregate functions like array_agg() or string_agg()
> that make this impossible, just like for many custom aggregates (like
> hyperloglog for example). Again, I might not understand the idea
> correctly ...

How would a combining function work for something like array_agg()?  I
don't think it would, at least if you want to preserve the ordering
option for the user.




pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Precedence of NOT LIKE, NOT BETWEEN, etc
Next
From: Josh Berkus
Date:
Subject: Re: mogrify and indent features for jsonb