Skip to content
This repository was archived by the owner on Apr 20, 2026. It is now read-only.

Latest commit

 

History

History
68 lines (50 loc) · 2.74 KB

File metadata and controls

68 lines (50 loc) · 2.74 KB
api_name compress_chunk()
excerpt Manually compress a given chunk
topics
compression
keywords
compression
tags
chunks
api
license type
community
function
products
cloud
mst
self_hosted

import Deprecated2180 from "versionContent/_partials/_deprecated_2_18_0.mdx";

compress_chunk() Community

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.

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

Samples

Compress a single chunk.

SELECT compress_chunk('_timescaledb_internal._hyper_1_2_chunk');

Required arguments

Name Type Description
chunk_name REGCLASS Name of the chunk to be compressed

Optional arguments

Name Type Default Required Description
chunk REGCLASS - Name of the chunk to add to the $COLUMNSTORE.
if_not_columnstore BOOLEAN true Set to false so this job fails with an error rather than a warning if chunk is already in the $COLUMNSTORE.
recompress BOOLEAN false Set to true to recompress. In-memory recompression is attempted first; it falls back to internal decompress/compress.

Returns

Column Type Description
compress_chunk REGCLASS Name of the chunk that was compressed