Re: [GENERAL] Median, Quartile and Percentile Aggregate Functions - Mailing list pgsql-general

From Ed Loehr
Subject Re: [GENERAL] Median, Quartile and Percentile Aggregate Functions
Date
Msg-id 38C182BE.648A24A3@austin.rr.com
Whole thread Raw
In response to Re: [GENERAL] Median, Quartile and Percentile Aggregate Functions  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: [GENERAL] Median, Quartile and Percentile Aggregate Functions
List pgsql-general
Peter Eisentraut wrote:
>
> Patrik Hall writes:
>
> > I am in need of median, quartile and percentile functions in postgres.
> >
> > Has anybody implemented any of them allready?
>
> Haven't heard, but if you can come up with a way to calculate them with a
> single pass over the data rows (keeping several state variables, if
> necessary) then you're half way there to implementing your own aggregate
> function. See the Programmer's Guide on how that might be done.
>
> Incidentally I couldn't think of a way to do just that. In that case it
> will be *hard*.

Forgive me if I already said this...May I suggest a lovely little perl
package called Statistics::Descriptive which I use for this sort of
thing?  I know it's not exactly what your were looking for, but it's a
possible consideration if you happen to be accessing pgsql via
perl/DBI.

Cheers,
Ed Loehr

pgsql-general by date:

Previous
From: Jason Vasquez
Date:
Subject: Re: [GENERAL] Nested tables
Next
From: Alfred Perlstein
Date:
Subject: ERROR: copyObject: don't know how to copy 704