postgresqlautovacuum

Tracking Postgres Autovacuums


We've been experimenting with tweaking the autovacuum thresholds on some of our larger tables, because otherwise they never run, but also build up 10s of thousands of dead tuples. Using a query I found somewhere on SO, looking at the pg_stat_user_tables table, I'm able to see the last run time and the number of runs for the autovacuum, but I can't seem to find a history of the events. We're trying to keep track of how often they are running to get some idea of where a good threshold is, so that sort of info would be useful. Is there another table available for this?


Solution

  • There is no table with the history (unless you have created one of course or deployed some monitoring system that did it for you, but I don't know of such a one). You can set log_autovacuum_min_duration to zero, then you will have a record going forward in your log files.