Re: user defined aggregate for percentile calculations - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: user defined aggregate for percentile calculations
Date
Msg-id 20090406224914.GK4525@alvh.no-ip.org
Whole thread Raw
In response to Re: user defined aggregate for percentile calculations  (Kashmir <kashmir_us_1999@yahoo.com>)
List pgsql-general
Kashmir wrote:
>
> thx for anwering!,
>
> i was more looking for a percentile calculation as in http://en.wikipedia.org/wiki/Percentile
> usually i do this in perl with the 'Statistics::Descriptive' module,
> but it would help me alot if i could solve this within the sql query,
> and would not have to push all the data into a perl arrays first..

Have you considered writing a function in the PL/R language?  It has
percentiles (actually quantiles) and all sorts of useful math stuff.

See http://www.joeconway.com/plr/

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

pgsql-general by date:

Previous
From: Kashmir
Date:
Subject: Re: user defined aggregate for percentile calculations
Next
From: Greg Smith
Date:
Subject: Re: user defined aggregate for percentile calculations