开发者

Event Scheduler in PostgreSQL?

开发者 https://www.devze.com 2023-03-23 08:14 出处:网络
Is there a similar event scheduler from开发者_开发知识库 MySQL available in PostgreSQL?While a lot of people just use cron, the closest thing to a built-in scheduler is PgAgent.It\'s a component to th

Is there a similar event scheduler from开发者_开发知识库 MySQL available in PostgreSQL?


While a lot of people just use cron, the closest thing to a built-in scheduler is PgAgent. It's a component to the pgAdmin GUI management tool. A good intro to it can be found at Setting up PgAgent and doing scheduled backups.


pg_cron is a simple, cron-based job scheduler for PostgreSQL that runs inside the database as an extension. A background worker initiates commands according to their schedule by connecting to the local database as the user that scheduled the job.

pg_cron can run multiple jobs in parallel, but it runs at most one instance of a job at a time. If a second run is supposed to start before the first one finishes, then the second run is queued and started as soon as the first run completes. This ensures that jobs run exactly as many times as scheduled and don’t run concurrently with themselves.

If you set up pg_cron on a hot standby, then it will start running the cron jobs, which are stored in a table and thus replicated to the hot standby, as soon as the server is promoted. This means your periodic jobs automatically fail over with your PostgreSQL server.

Source: citusdata.com

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号