0Pricing
SQL Academy · Lesson

Compression and Retention Policies

Compress old chunks with TimescaleDB's columnar compression, and drop expired chunks automatically.

Why Compress?

Time-series data is highly compressible. TimescaleDB compresses chunks in columnar form, often achieving 10–20× compression ratios.

Compressing a Hypertable

Configure which columns segment and order the compressed data:

ALTER TABLE metrics SET (
  timescaledb.compress,
  timescaledb.compress_segmentby = 'device_id',
  timescaledb.compress_orderby = 'ts DESC'
);

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