Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Managed Service for PostgreSQL
  • Getting started
    • All tutorials
      • Managing extensions
      • pg_cron
      • pg_repack
      • pgaudit
      • pgcrypto
      • postgresql_anonymizer
      • Hunspell dictionaries for full-text search
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes
  1. Step-by-step tutorials
  2. PostgreSQL extensions and dictionaries
  3. pg_cron

Using pg_cron in Managed Service for PostgreSQL

Written by
Yandex Cloud
Updated at December 24, 2024

The pg_cron extension is a job scheduler that enables you to add scheduled jobs to a database and execute SQL commands directly from a job.

Install the pg_cron extension in a PostgreSQL clusterInstall the pg_cron extension in a PostgreSQL cluster

To install pg_cron in a PostgreSQL cluster:

  1. Connect the shared library named pg_cron to your cluster.

  2. Add the pg_cron extension to one of the databases. You cannot enable the extension for two databases.

    Warning

    Installing pg_cron will restart PostgreSQL on all cluster hosts one by one.

  3. Add a user with the mdb_admin role or mdb_superuser role to manage the jobs.

In the selected database, the cron schema with tables and functions required for the extension to work will appear:

  • Tables:

    • cron.job: Contains scheduled jobs. The SELECT command is allowed.
    • cron.job_run_details: Contains the history of extension runs. The SELECT, UPDATE, and DELETE commands are allowed.
  • Functions:

    • schedule: Creates a job in the database where the pg_cron extension is installed.
    • schedule_in_database: Creates a job in another database.
    • unschedule: Deletes a job.
    • alter_job: Modifies the job.

To learn more about the pg_cron extension, see its official documentation.

Was the article helpful?

Previous
Managing extensions
Next
pg_repack
© 2025 Direct Cursus Technology L.L.C.