pg_cron icon indicating copy to clipboard operation
pg_cron copied to clipboard

Add 'skip_queuing' column to cron.job table

Open anthares opened this issue 6 years ago • 3 comments

Dear pg_cron team,

I'd like to discuss the addition of the ability to control job queuing when the same job is already running.

I use stored procedures to ensure retention on high volume tables. Those procedures are aimed to delete and update records older than a given date in several tables. Due to the variance in the amount of rows to delete, the run time of those jobs is highly volatile. Currently they are triggered by the linux cron daemon every minute and we use the flock command to avoid concurrent execution with the -n flag to skip execution.

I want to migrate those jobs to pg_cron, but pg_cron currently queues all jobs when the same job is already running.

Could you please consider the addition of a boolean flag in the cron.job table to control that behavior ?

Best regards

anthares avatar May 23 '19 09:05 anthares

I would love to see that feature, too.

just-doit avatar Jul 02 '19 12:07 just-doit

throwing some love into this feature request. the default action on cron entries could be to queue, but with an option to not queue.

baldpope avatar Nov 09 '21 15:11 baldpope

I as well. We would use postgresql advisory locks to prevent 'running over the top' of an existing cron (we use functions for all our pg_cron stuffs). An optional flag for this would be awespectacular

casperjeff avatar Nov 09 '21 15:11 casperjeff