Questions tagged [pg-cron]

30 questions
3
votes
3 answers

using pg_cron extension on Cloud SQL

I am trying to use pg_cron to schedule calls on stored procedure on several DBs in a Postgres Cloud SQL instance. Unfortunately it looks like pg_cron can only be only created on postgres DB When I try to use pg_cron on a DB different than postgres I…
3
votes
1 answer

How do I install the pg_cron extension in Postgres 13 hosted in my Windows 10

I see a few guides for installing the pg_cron extension in windows, but its very confusing. Is there any guide that can help? A simple create extension in the database doesnt work. I get the below error : ERROR: could not open extension control…
Goutam Sahoo
  • 59
  • 2
  • 9
2
votes
2 answers

How to run Postgres pg_cron Job AFTER another Job?

I running some automated tasks on my postgres database at night using the pg_cron extension. I am moving certain old records to archive database tables. I am running 5 Stored Procedures concurrently on 5 different background workers, so they all…
ennth
  • 1,698
  • 5
  • 31
  • 63
1
vote
0 answers

pg_cron fails to execute transaction block

I have 5 jobs which contain a transaction block (similar code just modifying different tables) which get executed through pg_cron background workers and are passed as a naked string to scheduler. The blocks consist of BEGIN;(some queries)END; and…
nzivkovic
  • 11
  • 2
1
vote
1 answer

pg_cron failing when using transaction block

I have a query as a transaction, using BEGIN and COMMIT. When I run this as a query it succeeds, however when I run it through pg_cron I receive the following error: FATAL: EndTransactionBlock: unexpected state BEGIN BEGIN;TRUNCATE app_top50;INSERT…
dojogeorge
  • 1,674
  • 3
  • 25
  • 35
1
vote
1 answer

Unable to run multiple jobs in parallel in pgcron

I have scheduled multiple jobs in Postgresql through pgcron and some of their schedules overlap. For example: Job 1 scheduled to run every 15 minutes. This job takes less than a minute to complete. Job 2 scheduled to run every Saturday at 7 PM. This…
PraveenDS
  • 51
  • 3
1
vote
0 answers

How can I make a Supabase CRON job to delete specific data every day?

I want to give users a period of time in which they can undo their account deletion. Someone suggested that I should use a CRON job that (1) checks my Supabase table daily for users who deleted their accounts over 30 days ago and (2) deletes those…
Globe
  • 169
  • 11
1
vote
0 answers

Multiple Materialized view refresh via pg_cron blocks other scheduled cron jobs

I have a table "T1". 2 materialized views MV1 and MV2 built on T1. The materialized views have aggregate functions on the data. Using pg_cron, I scheduled view refresh (concurrent) at 5 min, 15 min and 12 hours for MV1, MV2 and MV3 respectively.The…
1
vote
2 answers

How to run pg_cron job as per local time?

Currently pg_cron works as per UTC/ GMT time only. There is no configuration option available to run job as per local time server time. How to run pg_cron job as per local time?
Darshan Shah
  • 157
  • 1
  • 1
  • 15
1
vote
1 answer

Postgres pg_cron (cron.max_running_jobs valid range)

Aurora Postgres 12.8 Created pg_cron job, everything looks good in cron.job, but the job actually didn't work and cron.job_run_details didn't get any record either. RDS console log shows the following error 5 is outside the valid range for parameter…
user3706888
  • 159
  • 2
  • 11
1
vote
3 answers

Installation of pg_cron on Azure Flexible PostgeSQL

I am trying to install pg-cron extension for Azure PostgreSQL Flexible server. According to documentation found here: https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-extensions#postgres-13-extensions pg_cron is available…
0
votes
0 answers

Scheduling pg_cron in PostgreSQL using liquiBase

I am trying to schedule pg_cron job using liquiBase, script is marked as EXECUTED in DATABASECHANGELOG, however, in CRON.JOB table there are no jobs added. Part of data: liquibase.properties:…
Kropek
  • 31
  • 1
  • 1
  • 3
0
votes
0 answers

Run a select/update statement against a specific postgres database

I have an RDS postgres database with pg_cron installed. Dev ops is claiming that pg_cron can only be installed for the default "postgres" database. I would like to be able to schedule jobs in pg_cron, but any attempt to do so from my database…
John O
  • 4,863
  • 8
  • 45
  • 78
0
votes
0 answers

pg_cron Multiple Statements to run pg_partman maintenance

I'm trying to implement automation on pg_partman maintenance using pg_cron, but the cron job needs to run with a role that doesn't have LOGIN permissions. My though was that I could do something like this: SELECT cron.schedule('Partition…
0
votes
1 answer

Can't create extension pg_cron in bitnami:postgres docker container?

I am running a docker container with a Database which is working with the bitnami:postgres image. It is all working fine but now I want to install pg_cron to schedule autmatic jobs. I installed it and it is available as a possible extension in…
Tom
  • 31
  • 2
1
2