Tier chunks
Tiering a chunk is an asynchronous process that schedules the chunk to be tiered. In the following example, you tier chunks older than three days in the example hypertable. You then list the tiered chunks.
Select all chunks in
examplethat are older than three days:sqlSELECT show_chunks('example', older_than => INTERVAL '3 days');This returns a list of chunks. Take a note of the chunk names:
sql_timescaledb_internal._hyper_1_1_chunk _timescaledb_internal._hyper_1_2_chunkCall
tier_chunkto manually tier each chunk:sqlSELECT tier_chunk('_timescaledb_internal._hyper_1_1_chunk');Repeat for all chunks you want to tier.
Tiering a chunk schedules it for migration to the object storage tier, but the migration won't happen immediately. Chunks are tiered one at a time in order to minimize database resource consumption. A chunk is marked as migrated and deleted from the standard storage only after it has been durably stored in the object storage tier. You can continue to query a chunk during migration.
To see which chunks are tiered into the object storage tier, use the
tiered_chunksinformational view:sqlSELECT * FROM timescaledb_osm.tiered_chunks;
To see which chunks are scheduled for tiering either by policy or by a manual call, but have not yet been tiered, use this view:
SELECT * FROM timescaledb_osm.chunks_queued_for_tiering ;