0PricingLogin
SQL Academy · Lesson

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

  1. TimescaleDB Hypertables
  2. Continuous Aggregates
  3. Compression and Retention Policies
  4. Time-Series Index Choices
← Back to SQL Academy