Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers

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


--Chris Albertson

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


pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group