Обсуждение: SQL speedup on timestamp filtering

Поиск
Список
Период
Сортировка

SQL speedup on timestamp filtering

От
Jean-Christophe ARNU (JX)
Дата:
Hi there :)

    I have a large table with (not only but important) timestamp and value
(double) columns.
    I would like to "sample" data at given timestamps values (I have one value
each minute and I would like to get each 5 minutes value on a given timestamp
range) and get the corresponding values.

    As I'm quite bad at SQL but is there a way with pg to get a timestamp modulo
an interval? Is there a way to optimize this (indexing in a different way,
designing database another way or writting stored procedure that would do the
job efficiently)?

    Thanks in advance!

--
Jean-Christophe ARNU
Paratronic