Autoanalyze
While technically a part of the same autovacuum daemon, the autoanalyze logic works a bit differently. The server keeps an internal count of how many tuples (rows) were in each table the last time it was analyzed. It then adds the estimated counts it keeps for live and dead tuples in the database (the ones you can see in pg_stat_user_tables
) and triggers when these numbers drift too far. While regular autovacuum only cares about rows that are dead because of UPDATE
, DELETE
, and ROLLBACK
, autoanalyze also counts tables that have expanded through simple INSERT
additions too.
By the time you've made it through the much more difficult to set up and monitor autovacuum work on your server, the similar but simpler autoanalyze work should be straightforward. While you can't see the internal tuple count to predict exactly when it will kick in, the main two statistics that drive it, the live and dead tuple counts, are shown along with the last time the two types of analysis...