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

From Peter Eisentraut
Subject Re: [GENERAL] Median, Quartile and Percentile Aggregate Functions
Date
Msg-id Pine.LNX.4.21.0003040343420.489-100000@localhost.localdomain
Whole thread Raw
In response to Median, Quartile and Percentile Aggregate Functions  (Patrik Hall <phall@phall.kdsoft.fi>)
List 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@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden


pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [GENERAL] Nested tables
Next
From: Peter Eisentraut
Date:
Subject: Re: [GENERAL] Illegal use of aggregates or non-group column in target list