Re: [PATCH] Negative Transition Aggregate Functions (WIP) - Mailing list pgsql-hackers

From David Rowley
Subject Re: [PATCH] Negative Transition Aggregate Functions (WIP)
Date
Msg-id CAApHDvoXMAUrKrvVZiMq-yCiX-zLYAPa7D+f9OC=MizEc2vGqg@mail.gmail.com
Whole thread
In response to Re: [PATCH] Negative Transition Aggregate Functions (WIP)  (Greg Stark <stark@mit.edu>)
List pgsql-hackers
On Sun, Dec 15, 2013 at 12:48 PM, Greg Stark <stark@mit.edu> wrote:


On 14 Dec 2013 15:40, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:
>
> David Rowley <dgrowleyml@gmail.com> writes:
> > The attached patch is not quite finished yet, I've not yet fully covered
> > SUM and AVG for all types.
>
> I think you *can't* cover them for the float types; roundoff error
> would mean you don't get the same answers as before.

I was going to say the same thing. But then I started to wonder.... What's so special about the answers we used to give? They are also subject to round off and the results are already quite questionable in those cases.

I guess they probably shouldn't be, subject to rounding / influenced by errors from tuples that are out of scope of the aggregate context.
Though saying that it would be a shame to have this optimisation for all but float and double. I can imagine the questions in [GENERAL].. Why is SUM(<int>) OVER ().. fast but SUM(<float>) OVER () slow? I wonder what other RDBMS' do here...

Regards

David Rowley

pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: [PATCH] Negative Transition Aggregate Functions (WIP)
Next
From: Tom Lane
Date:
Subject: Re: ruleutils vs. empty targetlists