[Yandex Cloud documentation](../../../index.md) > [Yandex Managed Service for PostgreSQL](../../index.md) > [Step-by-step guides](../index.md) > PostgreSQL extensions and dictionaries > pg_cron

# Using pg_cron in Managed Service for PostgreSQL

The [pg_cron](https://github.com/citusdata/pg_cron) extension is a job scheduler allowing you to schedule database tasks and run SQL queries directly within a job.

## Install the pg_cron extension in your PostgreSQL cluster {#pg_cron-install}

To install `pg_cron` in a PostgreSQL cluster:

1. [Load the shared library](cluster-extensions.md#libraries-connection) `pg_cron` into your cluster.
1. [Enable](cluster-extensions.md#update-extensions) the `pg_cron` extension in one of your databases. You cannot enable this extension for two databases.

    {% note warning %}

    Installing `pg_cron` will trigger a rolling restart of PostgreSQL on all cluster hosts.

    {% endnote %}

1. [Add](../grant.md#grant-privilege) the [`mdb_admin` role](../../concepts/roles.md#mdb-admin) to the user who will manage tasks.

The database will now contain the `cron` schema with tables and functions required for the extension:

* Tables:

    * `cron.job`: Contains scheduled jobs. You can run `SELECT` queries on this table.
    * `cron.job_run_details`: Contains extension run history. You can run `SELECT`, `UPDATE`, and `DELETE` queries on this table.

* Functions:

    * `schedule`: Creates a job in the database with the installed `pg_cron` extension.
    * `schedule_in_database`: Creates a job in a different database.
    * `unschedule`: Deletes a job.
    * `alter_job`: Alters a job.

Learn more about the `pg_cron` extension in [this official guide](https://github.com/citusdata/pg_cron).