Skip to main content
Old API since 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 . 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 s by running the job associated with your compression policy. compress_chunk gives you more fine-grained control by allowing you to target a specific that needs compressing.
You can get a list of s belonging to a using the show_chunks function.

Samples

Compress a single .
SELECT compress_chunk('_timescaledb_internal._hyper_1_2_chunk');

Arguments

The syntax is:
SELECT compress_chunk(
    uncompressed_chunk = '<chunk_name>',
    if_not_compressed = true | false,
    recompress = true | false
);
NameTypeDefaultRequiredDescription
chunk_nameREGCLASS-Name of the to be compressed
if_not_compressedBOOLEANtrue-Disabling this will make the function error out on s that are already compressed.

Returns

ColumnTypeDescription
compress_chunkREGCLASSName of the that was compressed