Re: WITHIN GROUP patch - Mailing list pgsql-hackers

From Tom Lane
Subject Re: WITHIN GROUP patch
Date
Msg-id 24268.1386188154@sss.pgh.pa.us
Whole thread Raw
In response to Re: WITHIN GROUP patch  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Responses Re: WITHIN GROUP patch
List pgsql-hackers
Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
>  Tom> Well, okay, but you've not said anything that wouldn't be
>  Tom> handled just as well by some logic that adds a fixed
>  Tom> integer-constant-zero flag column to the rows going into the
>  Tom> tuplesort.

> Adding such a column unconditionally even for non-hypothetical
> functions would break the optimization for sorting a single column
> (which is a big deal, something like 3x speed difference, for by-value
> types).

Well, sure, but I was only suggesting adding it when the aggregate asks
for it, probably via a new flag column in pg_aggregate.  The question
you're evading is what additional functionality could be had if the
aggregate could demand a different datatype or constant value for the
flag column.

> Adding it only for hypothetical set functions is making a distinction
> in how functions are executed that I don't think is warranted -

That seems like rather a curious argument from someone who's willing to
give up the ability to specify a regular transition value concurrently
with the flag column.

But anyway, what I'm thinking right now is that these questions would all
go away if the aggregate transfunction were receiving the rows and
sticking them into the tuplestore.  It could add whatever columns it felt
like.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Extension Templates S03E11
Next
From: Merlin Moncure
Date:
Subject: Re: Status of FDW pushdowns