Reputation: 165
In timescale DB, it is not allowed to alter the retention time interval of a hyper table. Is there any work around or other ways to alter the time interval after a retention policy is set for a hypertable?
Upvotes: 0
Views: 1702
Reputation: 1570
Have to only remove and add the policy back
select remove_retention_policy('tablename');
select add_retention_policy('tablename', INTERVAL '54 days');
link: timescale data retention
Upvotes: 0
Reputation: 3509
SELECT add_retention_policy('<table_name>', INTERVAL '1 hour');
SELECT j.hypertable_name,
j.job_id,
config,
schedule_interval,
job_status,
last_run_status,
last_run_started_at,
js.next_start,
total_runs,
total_successes,
total_failures
FROM timescaledb_information.jobs j
JOIN timescaledb_information.job_stats js
ON j.job_id = js.job_id
WHERE j.proc_name = 'policy_retention';
Get the job_id from the above table
Run this query to alter the job's schedule_interval
SELECT alter_job(1000, schedule_interval => INTERVAL '1 hour');
Upvotes: 0
Reputation: 146
Just remove the retention policy using remove_retention_policy and then add it back with the desired interval
Upvotes: 1