From: | "Peter Darley" <pdarley(at)kinesis-cem(dot)com> |
---|---|
To: | "Christoph Dalitz" <christoph(dot)dalitz(at)hs-niederrhein(dot)de>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Aggregate working on ordered data |
Date: | 2003-01-02 20:15:27 |
Message-ID: | NNEAICKPNOGDBHNCEDCPGEEMDEAA.pdarley@kinesis-cem.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Christoph,
Someone has probably answered you by now, but I'm kinda slow, so I'm adding
my 2 cents.
Here is a Median function that was written by Stephen Dobson and updated a
bit by myself. It's not terribly slow, but could probably be faster. If
you make any improvements to it, please return it to the list. It is
actually built of two functions that both need to exist. The comments are
in a state if disrepair.
Thanks,
Peter Darley
-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Christoph Dalitz
Sent: Thursday, December 19, 2002 1:41 AM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] Aggregate working on ordered data
Hello,
while trying to implement an aggregate function "median", I am
facing two problems:
a) In order to compute the median, the input values of the aggregate
function need to come in ordered.
b) Computation of the statistical median requires *two* runs of
the aggregation: a simple count and a run until count/2 on the
ordered data.
Is it at all possible to implemnt such an aggregate function in PostgreSQL?
If yes, all suggestions are appreciated.
Thanks,
Christoph Dalitz
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly
Attachment | Content-Type | Size |
---|---|---|
NewMedianFunction.txt | text/plain | 2.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Jeroen T. Vermeulen | 2003-01-02 20:30:57 | Re: [HACKERS] Cast your vote ... |
Previous Message | Dan Langille | 2003-01-02 20:07:48 | Re: [HACKERS] Cast your vote ... |