Latest

Tiger Cloud: Performance, Scale, Enterprise, Free

Self-hosted products

MST

Drop a single chunk from a hypertable.

drop_chunk() first validates the chunk status, then if it is safe to remove, it removes both the chunk table and its entry from the chunk catalog.

You cannot drop compressed chunks directly.

  • Drop a specific chunk by name:

    SELECT _timescaledb_functions.drop_chunk('_timescaledb_internal._hyper_1_2_chunk');
  • Drop a chunk using a variable:

    DO $$
    DECLARE
    chunk_name regclass;
    BEGIN
    SELECT show_chunks('conditions', older_than => INTERVAL '6 months')
    INTO chunk_name
    LIMIT 1;
    PERFORM _timescaledb_functions.drop_chunk(chunk_name);
    END $$;
NameTypeDefaultRequiredDescription
chunkREGCLASSThe name of the chunk to drop. You can use a schema-qualified name, such as _timescaledb_internal._hyper_1_2_chunk. If the chunk is in the search path, you can use the unqualified name.

Returns true when the chunk is successfully dropped.

Keywords

Found an issue on this page?Report an issue or Edit this page in GitHub.