diff --git a/advocacy_docs/pg_extensions/extensionrefs.json b/advocacy_docs/pg_extensions/extensionrefs.json index 02032016927..fe9f5665eeb 100644 --- a/advocacy_docs/pg_extensions/extensionrefs.json +++ b/advocacy_docs/pg_extensions/extensionrefs.json @@ -118,7 +118,7 @@ "mongo_fdw": "https://github.com/Percona-Lab/mongodb_fdw", "mysql_fdw": "https://github.com/EnterpriseDB/mysql_fdw", "bdr_5.x":"https://www.enterprisedb.com/docs/pgd/latest/", - "pg_cron":"https://github.com/citusdata/pg_cron", + "pg_cron":"https://www.enterprisedb.com/docs/pg_extensions/pg_cron/", "sql_profiler":"https://www.enterprisedb.com/docs/pem/latest/profiling_workloads/using_sql_profiler/", "pg_squeeze":"https://www.enterprisedb.com/docs/pg_extensions/pg_squeeze/", "wal2json":"https://www.enterprisedb.com/docs/pg_extensions/wal2json/", diff --git a/advocacy_docs/pg_extensions/index.mdx b/advocacy_docs/pg_extensions/index.mdx index 51282a95a48..c1dc26e3787 100644 --- a/advocacy_docs/pg_extensions/index.mdx +++ b/advocacy_docs/pg_extensions/index.mdx @@ -92,7 +92,7 @@ Categories of extensions: PostgreSQL Non-Contrib Extensions/Modules ip4r––––––– orafce––––––– -pg_cron–– +pg_cron–– pg_failover_slots pg_permissions––––––– pg_squeeze–– diff --git a/advocacy_docs/pg_extensions/pg_cron/configuring.mdx b/advocacy_docs/pg_extensions/pg_cron/configuring.mdx new file mode 100644 index 00000000000..15da3876dae --- /dev/null +++ b/advocacy_docs/pg_extensions/pg_cron/configuring.mdx @@ -0,0 +1,37 @@ +--- +title: Configuring pg_cron +navTitle: Configuring +--- + +1. In `postgresql.conf`, add `pg_cron` to the `shared_preload_libraries` parameter: + + ```ini + 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: +```ini +cron.database_name = 'mydbname' +``` + +1. You can alter the timezone of pg_cron from GMT if required: +```ini +cron.timezone = 'PRC' +``` + +1. Restart Postgres. + + +1. Create the `pg_cron` extension in your database: + + ```shell + CREATE EXTENSION pg_cron; + ``` + +1. Grant usage to `pg_cron` as needed to allow other users to schedule and manage their own jobs: +```ini +GRANT USAGE ON SCHEMA cron TO username; +``` \ No newline at end of file diff --git a/advocacy_docs/pg_extensions/pg_cron/index.mdx b/advocacy_docs/pg_extensions/pg_cron/index.mdx new file mode 100644 index 00000000000..bf41efe4e4f --- /dev/null +++ b/advocacy_docs/pg_extensions/pg_cron/index.mdx @@ -0,0 +1,23 @@ +--- +title: 'pg_cron' +indexCards: none +navigation: + - rel_notes + - installing + - configuring + - using +directoryDefaults: + product: pg_cron +--- + +`pg_cron` is an extension released as open source software under the PostgreSQL License. + +`pg_cron` is a cron-based job scheduler for PostgreSQL. You can schedule PostgreSQL commands directly from the database using a cron-based syntax. + +For more information about `pg_cron`, see: + +- [Installing pg_cron](installing.mdx) +- [Configuring pg_cron](configuring.mdx) +- [Using pg_cron](using.mdx) + + diff --git a/advocacy_docs/pg_extensions/pg_cron/installing.mdx b/advocacy_docs/pg_extensions/pg_cron/installing.mdx new file mode 100644 index 00000000000..c0246850376 --- /dev/null +++ b/advocacy_docs/pg_extensions/pg_cron/installing.mdx @@ -0,0 +1,71 @@ +--- +title: Installing pg_cron +navTitle: Installing +--- + +`pg_cron` is supported on the same platforms as the Postgres distribution you're using. Support for `pg_cron` starts with Postgres 10. For details, see: + +- [EDB Postgres Advanced Server Product Compatibility](https://www.enterprisedb.com/platform-compatibility#epas) +- [PostgreSQL Product Compatibility](https://www.enterprisedb.com/resources/platform-compatibility#pg) +- [EDB Postgres Extended Server Product Compatibility](https://www.enterprisedb.com/resources/platform-compatibility#epas_extended) + +## Installation + +Before you begin the installation process: + +- Install Postgres. See: + + - [Installing EDB Postgres Advanced Server](/epas/latest/installing/) + + - [Installing PostgreSQL](https://www.postgresql.org/download/) + + - [Installing EDB Postgres Extended Server](/pge/latest/installing/) + +- Set up the repository. + + Setting up the repository is a one-time task. If you've already set up your repository, you don't need to perform this step. + + To set up the repository, go to [EDB repositories](https://www.enterprisedb.com/repos-downloads) and follow the instructions provided there. + +## Install the package + +The syntax for the package install command is: + +```shell +# For SLES, CentOS, RHEL and its derivatives +sudo -y install edb--pg-cron1 + +# For Debian and Ubuntu +sudo -y install edb--pg-cron-1 +``` + +Where: +- ``is the package manager used with your operating system: + + | Package manager | Operating system | + | --------------- | -------------------------------- | + | dnf | RHEL 8/9 and derivatives | + | yum | RHEL 7 and derivatives, CentOS 7 | + | zypper | SLES | + | apt-get | Debian and derivatives | + +- `` is the distribution of Postgres you're using: + + | Postgres distribution | Value | + | ---------------------------- | ---------- | + | PostgreSQL | pg | + | EDB Postgres Advanced Server | as | + | EDB Postgres Extended Server | postgresextended | + +- `` is the version of Postgres you're using. + +For example, to install pg_cron for EDB Postgres Advanced Server 15 on a RHEL 8 platform: + +```shell +sudo dnf -y install edb-as15-pg-cron1 +``` + + + + + diff --git a/advocacy_docs/pg_extensions/pg_cron/rel_notes/index.mdx b/advocacy_docs/pg_extensions/pg_cron/rel_notes/index.mdx new file mode 100644 index 00000000000..ee92eb29320 --- /dev/null +++ b/advocacy_docs/pg_extensions/pg_cron/rel_notes/index.mdx @@ -0,0 +1,10 @@ +--- +title: 'pg_cron release notes' +navTitle: "Release notes" +indexCards: none +--- +The pg_cron documentation describes the latest version of pg_cron, including minor releases and patches. These release notes cover what was new in each release. For new functionality introduced in a minor or patch release, there are also indicators in the content about the release that introduced the feature. + +| Version | Release Date | +| ----------------------------------- | ------------ | +| [1.6.4](pg_cron_1.6.4_rel_notes) | 09 Aug 2024 | diff --git a/advocacy_docs/pg_extensions/pg_cron/rel_notes/pg_cron_1.6.4_rel_notes.mdx b/advocacy_docs/pg_extensions/pg_cron/rel_notes/pg_cron_1.6.4_rel_notes.mdx new file mode 100644 index 00000000000..cd60466bea6 --- /dev/null +++ b/advocacy_docs/pg_extensions/pg_cron/rel_notes/pg_cron_1.6.4_rel_notes.mdx @@ -0,0 +1,6 @@ +--- +title: Release notes for pg_cron version 1.6.4 +navTitle: "Version 1.6.4" +--- + +For `pg_cron` release notes, see the [pg_cron official release notes](https://github.com/citusdata/pg_cron/releases/). diff --git a/advocacy_docs/pg_extensions/pg_cron/using.mdx b/advocacy_docs/pg_extensions/pg_cron/using.mdx new file mode 100644 index 00000000000..6dcbf3eca8f --- /dev/null +++ b/advocacy_docs/pg_extensions/pg_cron/using.mdx @@ -0,0 +1,22 @@ +--- +title: Using pg_cron +navTitle: Using +--- + +Use `pg_cron` to schedule various database maintenance and management tasks. + +## Viewing the job status +```shell +select * from cron.job_run_details order by start_time desc limit 10; +``` + + +## Purging the `cron.job_run_details` table +```shell +SELECT cron.schedule('0 0 * * *', $$DELETE + FROM cron.job_run_details + WHERE end_time < now() - interval '14 days'$$); +``` + + +For more information on using `pg_cron`, see the [pg_cron documentation](https://github.com/citusdata/pg_cron). \ No newline at end of file