Skip to main content
Community An intrinsic part of time-series data is that new data is accumulated and old data is rarely, if ever, updated. This means that the relevance of the data diminishes over time. It is therefore often desirable to delete old data to save disk space. With , you can manually remove old s of data or implement policies using these APIs. For more information about creating a data retention policy, see the data retention section.

Samples

Create a data retention policy to discard chunks greater than 6 months old

SELECT add_retention_policy('conditions', drop_after => INTERVAL '6 months');
When you call drop_after, the time data range present in the partitioning time column is used to select the target s.

Create a data retention policy with an integer-based time column

SELECT add_retention_policy('conditions', drop_after => BIGINT '600000');

Create a data retention policy to discard chunks created before 6 months

SELECT add_retention_policy('conditions', drop_created_before => INTERVAL '6 months');
When you call drop_created_before, s created 3 months ago are selected.

Remove a retention policy

SELECT remove_retention_policy('conditions');
Removes the existing data retention policy for the conditions table.

Available functions