Skip to main content
Old API since 2.18.0. Superseded by Optimize your data for real-time analytics. However, compression APIs are still supported, you do not need to migrate to the hypercore APIs. You can enable compression on individual s, by declaring which column you want to segment by.

Enable a compression policy

This page uses an example table, called example, and segments it by the device_id column. Every chunk that is more than seven days old is then marked to be automatically compressed. The source data is organized like this:
  1. Alter the table At the psql prompt, alter the table:
  2. Add a compression policy Add a compression policy to compress chunks that are older than seven days:
For more information, see the API reference for ALTER TABLE (compression) and add_compression_policy.

View current compression policy

To view the compression policy that you’ve set:
For more information, see the API reference for timescaledb_information.jobs.

Pause compression policy

To disable a compression policy temporarily, find the corresponding job ID and then call alter_job to pause it:
To enable it again:

Remove compression policy

To remove a compression policy, use remove_compression_policy:
For more information, see the API reference for remove_compression_policy.

Disable compression

You can disable compression entirely on individual s. This command works only if you don’t currently have any compressed chunks:
If your contains compressed chunks, you need to decompress each chunk individually before you can turn off compression.