Manually drop chunks
Drop chunks manually by time value. For example, drop chunks containing data older than 30 days.
note
Dropping chunks manually is a one-time operation. To automatically drop chunks as they age, set up a data retention policy.
Drop chunks older than a certain date
To drop chunks older than a certain date, use the drop_chunks function. Supply the name of the hypertable to drop chunks from, and a time interval beyond which to drop chunks.
For example, to drop chunks with data older than 24 hours:
SELECT drop_chunks('conditions', INTERVAL '24 hours');
Drop chunks between 2 dates
You can also drop chunks between 2 dates. For example, drop chunks with data between 3 and 4 months old.
Supply a second INTERVAL
argument for the newer_than
cutoff:
SELECT drop_chunks(
'conditions',
older_than => INTERVAL '3 months',
newer_than => INTERVAL '4 months'
)
Drop chunks in the future
You can also drop chunks in the future, for example to correct data with the wrong timestamp. For example, to drop all chunks more than 3 months in the future:
SELECT drop_chunks(
'conditions',
newer_than => now() + INTERVAL '3 months'
);