Continuous Aggregates
Pre-aggregate time-series data with CONTINUOUS AGGREGATE materialised views and incremental refresh.
What Is a Continuous Aggregate?
A pre-computed, incrementally-refreshed aggregate over a hypertable — like a materialised view that updates intelligently as new data arrives.
Creating One
Hourly device averages:
CREATE MATERIALIZED VIEW metrics_hourly
WITH (timescaledb.continuous) AS
SELECT device_id,
time_bucket('1 hour', ts) AS hour,
AVG(value) AS avg_value,
COUNT(*) AS samples
FROM metrics
GROUP BY device_id, hour;All lessons in this course
- TimescaleDB Hypertables
- Continuous Aggregates
- Compression and Retention Policies
- Time-Series Index Choices