Enable compression on the hypertable with an orderby column to optimize columnar grouping: ALTER TABLE metrics SET (timescaledb.compress, timescaledb.compress_orderby = 'time DESC')
Optionally set a segmentby column for queries that always filter on a specific field: ALTER TABLE metrics SET (timescaledb.compress_segmentby = 'device_id')
Add an automated compression policy to compress chunks older than a threshold: SELECT add_compression_policy('metrics', INTERVAL '7 days')
Manually compress a specific chunk to test: SELECT compress_chunk('_timescaledb_internal._hyper_1_1_chunk')
Verify compressed vs uncompressed row counts and size: SELECT * FROM chunk_compression_stats('metrics')
Query compressed chunks transparently — no SQL changes needed; TimescaleDB decompresses on the fly during scans
Known gotchas
Updating or deleting rows in a compressed chunk requires decompression first; this happens automatically but triggers a recompression background job — high update rates on compressed chunks cause write amplification
The segmentby column must be a low-cardinality field; using a high-cardinality field (e.g. user_id with millions of values) produces many tiny compressed segments and negates compression gains
Compression policy runs as a background job; if the job falls behind due to resource contention, old uncompressed chunks accumulate — monitor job status via timescaledb_information.job_stats
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp