May 2018
Intermediate to advanced
576 pages
30h 25m
English
In recipe Controlling automatic database maintenance of Chapter 9, Regular Maintenance, we describe VACUUM, showing that it runs regularly on each table based on the number of rows that might need vacuuming ("dead rows"). VACUUM will run if that number exceeds a given threshold, which by default is just above 20% of the row count.
In this recipe we create a script that picks the table with the largest number of dead rows, and runs VACUUM on it.