← Projects

TimescaleDB rollups

Data ·

A time-series roll-up pipeline on PostgreSQL and TimescaleDB: instant charts at every zoom level, raw data kept for only a few hours.

  • PostgreSQL
  • TimescaleDB
  • SQL
  • Docker

The problem

Sensor data arrives dense, irregular and full of gaps. Dashboards want instant answers both for the last ten minutes and for the last two years; storage would rather get rid of raw data early.

What it does

A cascade of continuous aggregates (minute, hour, day, week, month), each built on the level below: every refresh only re-reads the previous, already small level. Averages are time-weighted, so a burst of close readings doesn’t skew the result, and each level has its own retention.

All in SQL, with realistic sample data and ready-made queries: it starts with a single docker compose up. It’s the generic version of a system I run in production for IoT device telemetry.