Creating automatic data retention policies
TimescaleDB includes a background job scheduling framework for automating data management tasks, such as enabling easy data retention policies.
To add such data retention policies, a database administrator can create, remove, or alter policies that cause drop_chunks
to be automatically executed according to some defined schedule.
To add such a policy on a hypertable, continually causing chunks older than 24 hours to be deleted, simply execute the command:
SELECT add_retention_policy('conditions', INTERVAL '24 hours');
To subsequently remove the policy:
SELECT remove_retention_policy('conditions');
The scheduler framework also allows one to view scheduled jobs:
SELECT * FROM timescaledb_information.job_stats;
For more information, please see the API documentation.
当前内容版权归 TimescaleDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 TimescaleDB .