tier_chunk()
Manually tier an individual chunk to object storage
Manually tier a single chunk to object storage. Use this to ship a specific chunk to the object store without waiting for the tiering policy to pick it up, or in environments where no tiering policy is configured.
The chunk is frozen in place and added to the tiering queue. An asynchronous worker uploads the chunk to the configured object store and removes the local copy when the upload completes. If tiering has not yet been set up for the hypertable, the foreign table backing the tiered chunks is created on first call.
Samples
Section titled “Samples”-
Tier a specific chunk:
SELECT tier_chunk('_timescaledb_internal._hyper_1_1_chunk'); -
Tier a chunk, ignoring the call when the chunk is already in the tiering queue:
SELECT tier_chunk('_timescaledb_internal._hyper_1_1_chunk', if_not_tiered => true);
Arguments
Section titled “Arguments”The syntax is:
SELECT tier_chunk( chunk = '<chunk_name>', if_not_tiered = true | false);| Name | Type | Default | Required | Description |
|---|---|---|---|---|
chunk | REGCLASS | - | ✔ | Name of the chunk to tier. Must be a real chunk of a hypertable, not the foreign table representing already-tiered data. |
if_not_tiered | BOOLEAN | false | - | When true, emit a notice rather than an error if the chunk is already queued for tiering. |
Returns
Section titled “Returns”This function returns void.
Errors
Section titled “Errors”tier_chunk raises an exception when:
- The supplied relation cannot be found as a chunk of a hypertable.
- The chunk is already queued for tiering and
if_not_tieredisfalse. - The chunk could not be frozen.