Using pg_cron

Suggest edits

Use pg_cron to schedule various database maintenance and management tasks.

Viewing the job status

select * from cron.job_run_details order by start_time desc limit 10;

Purging the cron.job_run_details table

SELECT cron.schedule('0 0 * * *', $$DELETE 
    FROM cron.job_run_details 
    WHERE end_time < now() - interval '14 days'$$);

For more information on using pg_cron, see the pg_cron documentation.


Could this page be better? Report a problem or suggest an addition!