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
- TimescaleDB Hypertables
- Continuous Aggregates
- Compression and Retention Policies
- Time-Series Index Choices