Configuring pg_cron

Suggest edits
  1. In postgresql.conf, add pg_cron to the shared_preload_libraries parameter:

    shared_preload_libraries = 'pg_cron'

    If shared_preload_libraries has other extensions, then you can add pg_cron to the list. The order doesn't matter.

  1. Metadata tables for pg_cron will be created in the "postgres" database, but you can alter this with:
cron.database_name = 'mydbname'
  1. You can alter the timezone of pg_cron from GMT if required:
cron.timezone = 'PRC'
  1. Restart Postgres.
  1. Create the pg_cron extension in your database:

    CREATE EXTENSION pg_cron;
  2. 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!