When is VACUUM needed
|
|
In this query:
relname
is the name of the table.
n_live_tup
is the number of live tuples (rows) in the table.
n_dead_tup
is the number of dead tuples in the table.
last_vacuum
shows when the last manual VACUUM was performed on the table.
last_autovacuum
shows when the last automatic VACUUM was performed.
This query will help you identify tables where the proportion of dead tuples to live tuples is high, indicating that a VACUUM might be beneficial. The threshold value (0.2 in this example) can be adjusted based on your database’s performance and maintenance needs.