Why does running
VACUUM FULL ANALYZE not update the
last_vacuum column in
pg_stat_user_tables in Postgres?
I have a moderately large database that requires some custom vacuuming and analyze procedures so those routines don't interfere with production performance. Therefore I scheduling a
VACUUM FULL ANALYZE to be run at certain "safe" periods. Previously, I was just running
VACUUM FULL, but this wasn't updating table statistics and was slowing down some queries, so I added
ANALYZE, and that fixed the performance issues.
However, I noticed something strange. I already had a monitor setup to alert me for when vacuum hadn't been run in a while, just in case someone changes some config that stops the cronjob from running, and after I added
ANALYZE, it started alerting me that vacuum was no longer being run.
Why is this?
There's nothing in the docs that says analyze disables vacuuming.
"VACUUM ANALYZE performs a VACUUM and then an ANALYZE for each selected table."
"VACUUM FULL rewrites the entire contents of the table into a new disk file with no extra space, allowing unused space to be returned to the operating system."
Granted, there's not explicit mention of what the expected behavior should be when
ANALYZE are used together with
I have a lot of inserts and deletions, so I want
VACUUM FULL to physically remove all dead tuples. I also want all table statistics to be updated.
Do I need to run