This alert is related to the PostgreSQL database and checks the time since the last autovacuum operation occurred on a specific table. If you receive this alert, it means that the table has not been vacuumed by the autovacuum daemon for more than a week (7 days).
Autovacuum is a feature in PostgreSQL that automates the maintenance of the database by reclaiming storage, optimizing the performance of the database, and updating statistics. It operates on individual tables and performs the following tasks:
ANALYZE
command.To check if the autovacuum daemon is running for the PostgreSQL instance, run the following SQL command:
SHOW autovacuum;
If the result is "off", then the autovacuum is disabled for the PostgreSQL instance. You can enable it by modifying the postgresql.conf
configuration file and setting autovacuum = on
.
Sometimes, autovacuum settings might be altered for individual tables. To check the autovacuum settings for the specific table mentioned in the alert, run the following SQL command:
SELECT relname, reloptions FROM pg_class JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace WHERE relname = '<table_name>' AND nspname = '<schema_name>';
Look for any custom autovacuum_*
settings in the reloptions
column and adjust them accordingly to allow the autovacuum daemon to run on the table.
Inspect the PostgreSQL logs for any error messages or unusual behavior related to autovacuum. The log file location depends on your PostgreSQL installation and configuration.
If the autovacuum daemon has not run for a long time on the table, you can manually vacuum the table to reclaim storage and update statistics. To perform a manual vacuum, run the following SQL command:
VACUUM (VERBOSE, ANALYZE) <schema_name>.<table_name>;