Re: Statistical Lacunae in Interval type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Fetter <david(at)fetter(dot)org>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Statistical Lacunae in Interval type
Date: 2004-07-12 14:30:43
Message-ID: 24017.1089642643@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Fetter <david(at)fetter(dot)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
like
stddev(extract(epoch from interval_col))
which mashes the intervals down to seconds.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2004-07-12 14:57:45 Re: Statistical Lacunae in Interval type
Previous Message James William Pye 2004-07-12 11:21:14 Re: [subxacts] Aborting a function