Re: wip: functions median and percentile

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Fetter <david(at)fetter(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: wip: functions median and percentile
Date: 2010-10-03 15:49:37
Message-ID: AANLkTimMoQpzCoL1OLASh0B5KPOG8tAm-3y=PhxbZS4y@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-rrreviewers

On Sun, Oct 3, 2010 at 7:06 AM, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bernd Helmle 2010-10-03 17:05:42 ALTER DATABASE RENAME with HS/SR
Previous Message Tom Lane 2010-10-03 15:29:12 Re: Heads up: upcoming back-branch releases

Browse pgsql-rrreviewers by date

  From Date Subject
Next Message Pavel Stehule 2010-10-03 17:31:18 Re: wip: functions median and percentile
Previous Message Hitoshi Harada 2010-10-03 14:06:25 Re: wip: functions median and percentile