Re: Statistical Lacunae in Interval type - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Statistical Lacunae in Interval type
Date
Msg-id 24017.1089642643@sss.pgh.pa.us
Whole thread Raw
In response to Statistical Lacunae in Interval type  (David Fetter <david@fetter.org>)
Responses Re: Statistical Lacunae in Interval type
List pgsql-hackers
David Fetter <david@fetter.org> writes:
> I just ran across this, and was wondering whether it's worth a
> back-patch.  The interval type has an aggregate for average (AVG), but
> not one for standard deviation (STDDEV) or variance (VARIANCE).

AFAICS, stddev/variance require the concept of multiplying two input
values together (square, and also square root, are in the formulas).
I don't know what it means to multiply two intervals --- there's no
such operator in Postgres, anyway.

You could possibly approximate the behavior you want with something
likestddev(extract(epoch from interval_col))
which mashes the intervals down to seconds.
        regards, tom lane


pgsql-hackers by date:

Previous
From: James William Pye
Date:
Subject: Re: [subxacts] Aborting a function
Next
From: Peter Eisentraut
Date:
Subject: Re: Statistical Lacunae in Interval type