Re: user defined aggregate for percentile calculations

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Kashmir <kashmir_us_1999(at)yahoo(dot)com>
Cc: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: user defined aggregate for percentile calculations
Date: 2009-04-06 22:49:14
Message-ID: 20090406224914.GK4525@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2009-04-06 23:03:24 Re: user defined aggregate for percentile calculations
Previous Message Kashmir 2009-04-06 22:32:17 Re: user defined aggregate for percentile calculations