Combine multiple intermediate statistical aggregate (StatsSummary1D) objects into a single StatsSummary1D object. It
is optimized for use in a window function context for computing tumbling window statistical aggregates.
Combine hourly continuous aggregates to create a tumbling window daily aggregate. Calculate the average and standard
deviation using the appropriate accessors:
CREATE MATERIALIZED VIEW foo_hourly
WITH (timescaledb.continuous)
ASSELECT
time_bucket('1h'::interval, ts) AS bucket,
stats_agg(value) asstats
FROM foo
GROUP BY1;
SELECT
bucket,
average(rolling(stats) OVER (ORDER BY bucket RANGE'1 day'PRECEDING)),
stddev(rolling(stats) OVER (ORDER BY bucket RANGE'1 day'PRECEDING)),