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

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
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 17:05:17
Message-ID: Pine.LNX.4.21.0003040343420.489-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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*.

--
Peter Eisentraut Sernanders väg 10:115
peter_e(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2000-03-04 17:05:29 Re: [GENERAL] Illegal use of aggregates or non-group column in target list
Previous Message Elmar.Haneke 2000-03-04 12:21:05 Re: [GENERAL] database corruption?