Re: proposal: tuplestore, tuplesort aggregate functions

From: David Fetter <david(at)fetter(dot)org>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: tuplestore, tuplesort aggregate functions
Date: 2010-08-18 15:05:50
Message-ID: 20100818150550.GA19312@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 18, 2010 at 04:46:57PM +0200, Pavel Stehule wrote:
> 2010/8/18 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> > David Fetter <david(at)fetter(dot)org> writes:
> >> Apart from the medians, which "median-like" aggregates do you
> >> have in mind to start with?  If you can provide examples of
> >> "median-like" aggregates that people might need to implement as
> >> user-defined aggregates, or other places where people would use
> >> this machinery, it will make your case stronger for this
> >> refactoring.
> >
> > There would be plenty of scope to re-use the machinery without any
> > SQL-level extensions.  All you need is a polymorphic aggregate
> > transition function that maintains a tuplestore or whatever. I
> > don't see that extra syntax in CREATE AGGREGATE is really buying
> > much of anything.
> >
>
> Have we to use a transisdent function? If we implement median as
> special variant of aggregate - because we need to push an sort, then
> we can skip a transident function function - and call directly final
> function. This mechanism is used for aggregates with ORDER BY now.
> So there can be a special path for direct call of final func. There
> is useles to call transident function.

Just a wacky idea here. Could we make a special state transition
function called IDENTITY or some such that would turn into a noop?

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2010-08-18 15:14:31 Re: git: uh-oh
Previous Message Heikki Linnakangas 2010-08-18 15:03:34 Re: pgsql: Coerce 'unknown' type parameters to the right type in the