Re: [GENERAL] Median, Quartile and Percentile Aggregate Functions

From: Ed Loehr <eloehr(at)austin(dot)rr(dot)com>
To: Patrik Hall <phall(at)phall(dot)kdsoft(dot)fi>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: [GENERAL] Median, Quartile and Percentile Aggregate Functions
Date: 2000-03-04 21:40:14
Message-ID: 38C182BE.648A24A3@austin.rr.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alfred Perlstein 2000-03-04 22:32:07 ERROR: copyObject: don't know how to copy 704
Previous Message Jason Vasquez 2000-03-04 17:28:30 Re: [GENERAL] Nested tables