Re: finding medians

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: finding medians
Дата
Msg-id 200205301330.09537.josh@agliodbs.com
обсуждение исходный текст
Ответ на finding medians  (Josh Burdick <jburdick@gradient.cis.upenn.edu>)
Список pgsql-hackers
Josh,

>     At the end of this message is some code I used to find medians.
>     It's kind of a hack, but approximately works, and is intended as a
> somewhat awkward stopgap for people who need to use medians.  It
> illustrates the limitations of the current aggregate function setup,
> which works so nicely for avg() and stddev().

Actually, finding the median is one of the classic SQL problems.  You can't do
it without 2 passes through the data set, disallowing the use of traditional
aggregate functions.  Joe Celko has half a chapter devoted to various methods
of finding the median.

Can I talk you into submitting your code to Techdocs?  I'd love to have it
somewhere where it won't get buried in the mailing list archives.

--
-Josh Berkus



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Josh Burdick
Дата:
Сообщение: finding medians
Следующее
От: "Dann Corbit"
Дата:
Сообщение: Re: finding medians