citusdata / pg_cron

Run periodic jobs in PostgreSQL
PostgreSQL License
2.9k stars 195 forks source link

schedule_in_database function wastes sequence values #358

Open caseyandgina opened 2 months ago

caseyandgina commented 2 months ago

I'm setting up some pg_cron jobs using Ansible, and was hoping to just call the schedule_in_database function on each deployment, as this will not create a job that already exists. However, I discovered that it does consume a value from the jobid_seq sequence even when it does not insert a new row, which is suboptimal as that will mean that my deployment scripts burn through a lot of sequence values unnecessarily. The column is a 64-bit integer which seems really overkill but should prevent this from becoming an actual problem in practice, but it would still be nice if it didn't consume sequence values unnecessarily.