Configuring pg_cron
Suggest editsIn
postgresql.conf
, addpg_cron
to theshared_preload_libraries
parameter:shared_preload_libraries = 'pg_cron'
If
shared_preload_libraries
has other extensions, then you can addpg_cron
to the list. The order doesn't matter.
- Metadata tables for
pg_cron
will 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_cron
extension in your database:CREATE EXTENSION pg_cron;
Grant usage to
pg_cron
as 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!