AW: [HACKERS] Implementing STDDEV and VARIANCE - Mailing list pgsql-hackers

From Zeugswetter Andreas SB
Subject AW: [HACKERS] Implementing STDDEV and VARIANCE
Date
Msg-id 219F68D65015D011A8E000006F8590C603FDC215@sdexcsrv1.f000.d0188.sd.spardat.at
Whole thread Raw
List pgsql-hackers
> 2. I am proposing the names stddev(x) and variance(x) for 
> population and 
> samplestddev(x) and
> samplevariance(x) for sample statistics. Any comments?

Other db's have:

stdev() for standard deviation  sample  (N-1)
variance() for variance computed from a sample (N-1)

> 3. I'm planning to implement this for types float4, float8 
> and numeric. Any 
> other types also? int[2,4,8] don't seem logical, as these 
> would introduce 
> serious rounding errors.

Integer would be good also. Do the arithmetic in numeric 
to avoid loss of precision.

Andreas


pgsql-hackers by date:

Previous
From: Jeroen van Vianen
Date:
Subject: Re: [HACKERS] Implementing STDDEV and VARIANCE
Next
From: Zeugswetter Andreas SB
Date:
Subject: Re: [HACKERS] column aliases