Re: [PATCH] Negative Transition Aggregate Functions (WIP)

From: Florian Pflug <fgp(at)phlo(dot)org>
To: Jim Nasby <jim(at)nasby(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kevin Grittner <kgrittn(at)ymail(dot)com>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, Greg Stark <stark(at)mit(dot)edu>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, David Rowley <dgrowleyml(at)gmail(dot)com>
Subject: Re: [PATCH] Negative Transition Aggregate Functions (WIP)
Date: 2014-01-11 03:19:30
Message-ID: 1CFA39EA-42C9-4A6F-BC5A-A5DA8B853A4B@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jan11, 2014, at 01:24 , Jim Nasby <jim(at)nasby(dot)net> wrote:
> On 1/10/14, 1:07 PM, Tom Lane wrote:
>> Florian Pflug<fgp(at)phlo(dot)org> writes:
>>> >On Jan10, 2014, at 19:08 , Tom Lane<tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>>> >>Although, having said that ... maybe "build your own aggregate" would
>>>> >>be a reasonable suggestion for people who need this? I grant that
>>>> >>it's going to be a minority requirement, maybe even a small minority
>>>> >>requirement. People who have the chops to get this sort of thing right
>>>> >>can probably manage a custom aggregate definition.
>>> >So we'd put a footgun into the hands of people who don't know what they're
>>> >doing, to be fired for performance's sake, and leave it to the people
>>> >who know what they are doing to put the safety on?
>> If I may put words in Kevin's mouth, I think his point is that having
>> float8 sum() at all is a foot-gun, and that's hard to deny. You need
>> to know how to use it safely.
>
> And IMHO if you've got something that's going to produce bad data if you do it
> wrong, I'd rather that the error be as large as possible so that you're more
> likely to discover it and fix it...

To that principle, I agree, I just don't think it applies here. An inverse
transition function greatly *increases* the chance of bogus results for
sum(float). It also breaks some rather natural assumptions that one might
make about sum(float)'s behaviour. For example, sums over single-element
frames current return the one row's value unchanged. That's no longer true
universally true with an inverse transition function. Even for an approximate
type, that's a bid too weird for my taste.

best regards,
Florian Pflug

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2014-01-11 03:21:47 Re: newlines at end of generated SQL
Previous Message Bruce Momjian 2014-01-11 02:59:36 Re: pg_upgrade & tablespaces