Configuring pg_cron
In
postgresql.conf, addpg_cronto theshared_preload_librariesparameter:shared_preload_libraries = 'pg_cron'
If
shared_preload_librarieshas other extensions, then you can addpg_cronto the list. The order doesn't matter.Metadata tables for
pg_cronwill be created in the "postgres" database, but you can alter this with:cron.database_name = 'mydbname'
You can alter the timezone of pg_cron from GMT if required:
cron.timezone = 'PRC'
Restart Postgres.
Create the
pg_cronextension in your database:CREATE EXTENSION pg_cron;Grant usage to
pg_cronas needed to allow other users to schedule and manage their own jobs:GRANT USAGE ON SCHEMA cron TO username;
Could this page be better? Report a problem or suggest an addition!