Parallel jobs in Postgres
Solution to implement parallel jobs in Postgres
Problem
Common approach for running time consuming or maintenance tasks in databases is using job processes.
Two classic extensions that allow to launch scheduled jobs in Postgres are pgAgent
and pg_cron
.
Problem is that if you have database hosted in a cloud they might be unavailable. This happens for Postgres RDS in AWS cloud.
One of the unofficial recommendation from AWS team on support forum was to launch EC2 instance and trigger via crontab on that server psql which will execute some script or call an API on database side.
Such approach requires from you to keep (and pay for) separate EC2 instance. It has to be continiously up and running. Another advise was even more complex setup with Lambda functions.