From: | Josh Berkus <josh(at)agliodbs(dot)com> |
---|---|
To: | Josh Burdick <jburdick(at)gradient(dot)cis(dot)upenn(dot)edu>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: finding medians |
Date: | 2002-05-30 20:30:09 |
Message-ID: | 200205301330.09537.josh@agliodbs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Dann Corbit | 2002-05-30 20:48:28 | Re: finding medians |
Previous Message | Josh Burdick | 2002-05-30 20:16:43 | finding medians |