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

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Florian Pflug <fgp(at)phlo(dot)org>, 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>
Subject: Re: [PATCH] Negative Transition Aggregate Functions (WIP)
Date: 2014-01-14 09:16:47
Message-ID: CAApHDvr-m_79bdY_xhFd4WkPHdwd8tq4_vM42dwp7j4Ysa6SNA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 14, 2014 at 9:09 PM, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:

> I think unless anyone has some objections I'm going to remove the inverse
> transition for SUM(numeric) and modify the documents to tell the user how
> to build their own FAST_SUM(numeric) using the built in functions to do it.
> I'm starting to think that playing around with resetting numeric scale will
> turn a possible 9.4 patch into a 9.5/10.0 patch. I see no reason why what's
> there so far, minus sum(numeric), can't go in...
>
>
Of course its only now that I discover that this is not possible to do this:

CREATE AGGREGATE fast_sum (numeric)
(
stype = numeric,
sfunc = numeric_avg_accum,
invfunc = numeric_avg_accum_inv,
finalfunc = numeric_sum
);

because SUM(numeric) uses an internal type to store the transition state.

hmmm, built-in fast_sum anyone?
Is there any simple way to limit these to only be used in the context of a
window? If so is it worth it?
Would we want fast_sum() for float too?

Regards

David Rowley

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2014-01-14 09:16:58 Re: plpgsql.consistent_into
Previous Message Kyotaro HORIGUCHI 2014-01-14 09:16:20 Re: Using indices for UNION.