Hi, @SZ-6622 Welcome to Microsoft Q&A thanks for posting your question. You have to create the extension to implement this.
To create pg_cron in Azure PostgreSQL single server, you need to follow these steps:
- Connect to your Azure Database for PostgreSQL server using psql. You can use the following command:
psql --host=<fullyQualifiedDomainName> --port=5432 --username=<administratorLogin> --dbname=postgres
Make sure to replace <fullyQualifiedDomainName>
with the fully qualified domain name of your server and <administratorLogin>
with the administrator login.
2. Once connected, run the following command to install the pg_cron extension:
CREATE EXTENSION pg_cron;
3. After the extension is installed, you can schedule a cron job using the cron.schedule
function. For example, to schedule a job to run vacuum every day at 10:00am, you can use the following command:
SELECT cron.schedule('0 10 * * *', 'VACUUM');
...