Standard Deviation function.

From: Chris Albertson <chris(at)topdog(dot)pas1(dot)logicon(dot)com>
To: pgsql-hackers(at)hub(dot)org
Subject: Standard Deviation function.
Date: 1998-06-05 01:20:50
Message-ID: 357747F2.A256B26C@topdog.logicon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

I really need a Standard Deviation aggregate function so I will
try to write one.

I know about the man pages for "create aggregate" and "create
function". Is there something else I should look at?
Just a few pointers could save me a few hours of hunting around.
All advice accepted.

It seems kind of hard to do with only two state functions unless
I "cheat". I need to keep three values, Count, Sum, and Sum of
Squares. I could use three static variables and have the final
function ignore its input and use the static vars instead. This
will likely blow up if the new Standard Deviation aggregate is
used twice in the same select.

Any hints or advice??

If someone has this done already let me know.

I may want do a "median" aggregate function too as I'll need that
later. This would require private storage and a sort.

Could you cc me at both addresses below as I move around between
them

Thanks,

--
--Chris Albertson

chrisja(at)jps(dot)net
chris(at)topdog(dot)logicon(dot)com Voice: 626-351-0089 X127
Fax: 626-351-0699

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stupor Genius 1998-06-05 01:35:56 RE: [HACKERS] Standard Deviation function.
Previous Message USA Publishing Co. 1998-06-05 00:43:37 Wanted Home Product Assemblers