Latest

Tiger Cloud: Performance, Scale, Enterprise, Free

Self-hosted products

MST

Old API since TimescaleDB v2.18.0 Superseded by convert_to_columnstore(). However, compression APIs are still supported, you do not need to migrate to the hypercore APIs.

The compress_chunk function is used for synchronous compression (or recompression, if necessary) of a specific chunk. This is most often used instead of the add_compression_policy function, when a user wants more control over the scheduling of compression. For most users, we suggest using the policy framework instead.

You can also compress chunks by running the job associated with your compression policy. compress_chunk gives you more fine-grained control by allowing you to target a specific chunk that needs compressing.

Tip

You can get a list of chunks belonging to a hypertable using the show_chunks function.

Compress a single chunk.

SELECT compress_chunk('_timescaledb_internal._hyper_1_2_chunk');
NameTypeDescription
chunk_nameREGCLASSName of the chunk to be compressed
NameTypeDefaultRequiredDescription
chunkREGCLASS-Name of the chunk to add to the columnstore.
if_not_columnstoreBOOLEANtrueSet to false so this job fails with an error rather than a warning if chunk is already in the columnstore.
recompressBOOLEANfalseSet to true to recompress. In-memory recompression is attempted first; it falls back to internal decompress/compress.
ColumnTypeDescription
compress_chunkREGCLASSName of the chunk that was compressed

Keywords

Found an issue on this page?Report an issue or Edit this page in GitHub.