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

From Greg Stark
Subject Re: wip: functions median and percentile
Date
Msg-id AANLkTimMoQpzCoL1OLASh0B5KPOG8tAm-3y=PhxbZS4y@mail.gmail.com
Whole thread Raw
In response to Re: wip: functions median and percentile  (Hitoshi Harada <umi.tanuki@gmail.com>)
Responses Re: wip: functions median and percentile
List pgsql-hackers
On Sun, Oct 3, 2010 at 7:06 AM, Hitoshi Harada <umi.tanuki@gmail.com> wrote:
> And I'm now thinking about how to make median happen in window
> aggregate.

If you were to do this by extending tuplesort what extra features
would tuplesort need?

Would tuplesort need the ability to insert additional records into an
already sorted array and maintain the sort?
Would it need the ability to remove records from the sorted set?
Would it need the ability to do a partial sort (the QuickSelect algorithm)?
The ability to do random access on disk sets?

How do existing windowed aggregates work if you specify an order by on
the aggregate? Do they resort for every output row?

Does the spec give a way to run an arbitrary subselect on the current
window? I wonder if we need more powerful machinery anyways to handle
these cases.

-- 
greg


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Heads up: upcoming back-branch releases
Next
From: Hitoshi Harada
Date:
Subject: Re: [RRR] top-level DML under CTEs