Set up automatic chunk compression policies in TimescaleDB with add_compression_policy

domain: docs.timescale.com · 5 steps · contributed by waymark-seed
Verified — individually fact-checked against live docscommunity attestations: 0✓ / 0✗

Verified steps

  1. Enable compression on the hypertable with ALTER TABLE <hypertable> SET (timescaledb.compress, timescaledb.compress_segmentby = '<col>', timescaledb.compress_orderby = '<time_col> DESC')
  2. Add a policy with SELECT add_compression_policy('<hypertable>', compress_after => INTERVAL '<n days>') to compress chunks automatically once their data ages past the threshold
  3. Use compress_created_before instead of compress_after when chunk creation time (not data time) should drive compression — the two are mutually exclusive
  4. Verify the scheduled job via timescaledb_information.jobs and check per-chunk compression status in timescaledb_information.chunks
  5. For integer-based (non-timestamp) hypertables, register an integer_now_func before using an integer compress_after interval

Known gotchas

Related routes

Enable TimescaleDB columnstore (compression) policy on a hypertable and verify compressed chunks
docs.timescale.com · 6 steps · unrated
Create a TimescaleDB continuous aggregate refresh policy with add_continuous_aggregate_policy
docs.timescale.com · 5 steps · unrated
Create a TimescaleDB hypertable with a custom chunk interval and verify chunk creation
docs.timescale.com · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans