i have a sliding window problem. specifically, i do not know where my window should start and where it should end. i do know the size of my interval/window.
SELECT *,
(
SELECT SUM(value)
FROM mytable mi
WHERE mi.tstamp BETWEEN m.tstamp - '2.5 minute'::INTERVAL AND m.tstamp + '2.5 minute'::INTERVAL
) AS maxvalue
FROM mytable m
ORDER BY
maxvalue DESC
LIMIT 1