Re: Passing "direct" args of ordered-set aggs to the transition function

From: Florian Pflug <fgp(at)phlo(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Passing "direct" args of ordered-set aggs to the transition function
Date: 2014-01-23 16:40:52
Message-ID: 68FB3094-3178-4DF9-B50C-47CC18B5125D@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jan23, 2014, at 17:20 , Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Florian Pflug <fgp(at)phlo(dot)org> writes:
>> Is there a particular reason why the "direct" arguments of ordered-set
>> aggregates are not passed to the transition function too?
>
> Because they have to be evaluated only once.
>
> I did consider evaluating them once at the start and saving the values,
> but that's a bit problematic from a memory management standpoint.

Yeah, that's what I had in mind. I not sure I understand that memory
management problems you mention though - couldn't we just copy them to
some appropriate memory context, say aggcontext?

What I'm more concerned about is whether it'd still be possible to have
ordered_set_transition and ordered_set_transition_multi work for all the
ordered-set aggregates we currently have. But I have yet to wrap my head
fully around the VARIADIC any ANY stuff that goes on there...

> Still, if you have a good solution to that and the cycles to produce a
> patch, it's not too late to reconsider. I concur that it's not that
> hard to think of cases where it'd be useful.

I'll see what I can do.

best regards,
Florian Pflug

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-01-23 16:48:39 Re: Add %z support to elog/ereport?
Previous Message Tom Lane 2014-01-23 16:25:56 Re: Add %z support to elog/ereport?