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.
To drop chunks older than a certain date, use the drop_chunks
function. Provide 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');
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')
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');
Keywords
Found an issue on this page?Report an issue or Edit this page in GitHub.