Skip to content

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.

  • 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);

The syntax is:

SELECT tier_chunk(
chunk = '<chunk_name>',
if_not_tiered = true | false
);
NameTypeDefaultRequiredDescription
chunkREGCLASS-Name of the chunk to tier. Must be a real chunk of a hypertable, not the foreign table representing already-tiered data.
if_not_tieredBOOLEANfalse-When true, emit a notice rather than an error if the chunk is already queued for tiering.

This function returns void.

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_tiered is false.
  • The chunk could not be frozen.