Re: Proposal: Pre ordered aggregates, default ORDER BY clause for aggregates - median support

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: Pre ordered aggregates, default ORDER BY clause for aggregates - median support
Date: 2009-12-21 01:37:51
Message-ID: 407d949e0912201737m4c503878y8db53fbdbe317e6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Incidentally there are O(n) algorithms for finding the median (or any
specific offset). It shouldn't be necessary to sort at all.

I'm not sure which path this argues for - perhaps Tom's position that
we need more optimiser infrastructure so we can see how to accomplish
this. Perhaps it means you should really implement median() with an
internal selection alagorithm and not depend on the optimizer at all.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2009-12-21 02:16:01 Re: Patch: Remove all declarations from pg_attribute.h, consolidate BKI scripts
Previous Message Robert Haas 2009-12-21 01:23:39 Re: Patch: Remove all declarations from pg_attribute.h, consolidate BKI scripts