Sum of multiplied deltas

Поиск
Список
Период
Сортировка
От Gerhard Wiesinger
Тема Sum of multiplied deltas
Дата
Msg-id alpine.LFD.2.00.0906080831290.13493@bbs.intern
обсуждение исходный текст
Ответы Re: Sum of multiplied deltas  (David Fetter <david@fetter.org>)
Re: Sum of multiplied deltas  ("Daniel Verite" <daniel@manitou-mail.org>)
fulltext search udf  (Andreas Wenk <a.wenk@netzmeister-st-pauli.de>)
Re: Sum of multiplied deltas  (Gerhard Wiesinger <lists@wiesinger.com>)
Список pgsql-general
Hello!

I've the following data:
datetime | val1 | val2
time1    |    4 | 40%
time2    |    7 | 30%
time3    |   12 | 20%
...

I'd like to sum up the following:

(7-4)*30% + (12-7)*20% + ...

datetime is ordered (and unique and has also an id).

Rows are in the area of millions.

How is it done best?
1.) Self join with one row shift?
2.) function?

Any hint?

Thnx.

Ciao,
Gerhard

--
http://www.wiesinger.com/


В списке pgsql-general по дате отправления:

Предыдущее
От: "Gauthier, Dave"
Дата:
Сообщение: Server admin for Clients ?
Следующее
От: "Anirban Pal"
Дата:
Сообщение: Why lots of temp schemas are being created