Re: wip: functions median and percentile - Mailing list pgsql-hackers

From Greg Stark
Subject Re: wip: functions median and percentile
Date
Msg-id AANLkTimEmkGv7jp+KJ0V1awU3gar-XMiL92zt4K3UVpr@mail.gmail.com
Whole thread Raw
In response to wip: functions median and percentile  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: wip: functions median and percentile
List pgsql-hackers
On Wed, Oct 13, 2010 at 5:54 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> Or to put it more bluntly - what is the "problem with planner and hash
> agg" that all of these functions need to solve?  And why does it need
> a flag in pg_proc?  Why can't't we leave it to the individual
> functions to perform a sort of one is needed?
>

So I think that's backwards. Why is the function doing data
manipulations like sorts that we usually put in the plan? Is there
some some key meta information that should be flagged in pg_proc and
general functionality the executor should be providing so that this
general class of problems can be solved efficiently?

Otherwise I fear lots of things we would expect to be efficient such
as calculating the top, median, and last items in the same sort order
would require three separate sorts of the same data. We have a planner
capable of comparing sort orders and estimating the costs of different
plans, we should be using it.


--
greg


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: WIP: extensible enums
Next
From: Magnus Hagander
Date:
Subject: Re: duplicate connection failure messages