Re: nodeAgg perf tweak - Mailing list pgsql-hackers

From Neil Conway
Subject Re: nodeAgg perf tweak
Date
Msg-id 1102031840.22124.214.camel@localhost.localdomain
Whole thread Raw
In response to Re: nodeAgg perf tweak  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: nodeAgg perf tweak
List pgsql-hackers
On Thu, 2004-12-02 at 10:45 -0500, Tom Lane wrote:
> (2) I think you lose much of the performance
> benefit as soon as you have to distinguish cases (b) and (c).  Ideally
> you would use MemoryContextContains for this, but that doesn't work
> reliably on pointers that point to fields of a tuple.

Why wouldn't a simple comparison work? We're passing two arguments into
the aggregate function: (a) corresponds to returning the first argument,
and (b) corresponds to returning the second argument. If the aggregate
wants to do something more than just return one of the arguments, they
can copy/alloc in the current context.

> I like the approach shown in my prototype patch better, because it
> doesn't create any backwards-compatibility issues for existing aggregate
> functions; instead individual aggregates may be rewritten to avoid
> palloc's.

Yeah, I like your approach as well (sorry, I had thought Simon's earlier
suggestion along these lines would have required adding knowledge about
builtin aggregates to advance_transition_function() itself; adding
knowledge to the aggregate implementation is a lot nicer).

-Neil




pgsql-hackers by date:

Previous
From: Travis P
Date:
Subject: Re: 8.0RC1 tomorrow
Next
From: Andrew Dunstan
Date:
Subject: Re: multiline CSV fields