Sample Header Ad - 728x90

Use pg_cron to run VACUUM on multiple tables

3 votes
2 answers
5629 views
Reading the pg_cron documentation I saw that the examples only execute a command when scheduling a task. In a StackOverflow post I saw that a user tried to run multiple VACUUM when scheduling the task, but an error occurs. Is there a way to run VACUUM on multiple tables in sequence using pg_cron? There are about 112 selected tables that must be vacuumed, out of a total of 155, so scheduling a task for each one is not very practical. Or for example, delete old records from a table and immediately at the end of the process run cron on selected tables?
Asked by Tom (438 rep)
Nov 24, 2021, 02:07 AM
Last activity: Jul 18, 2023, 09:27 PM