Automatic analyze

The automatic analyze is a fallback that executes ANALYZE on a table to update statistics.

The fallback runs where table statistics do not exist, are outdated, or where a table has still to be or cannot be picked up yet by the autovacuum daemon. The fallback does not affect tables with up-to-date statistics. Up-to-date statistics on all tables are essential for the query planner to accurately estimate row counts and therefore execute queries optimally.

If the autovacuum daemon is enabled, it analyzes in most cases your tables for you and no automatic analyze is triggered. Cases in which the automatic analyze is triggered are for example a CREATE TABLE AS statement followed immediately by a SELECT statement, tables that only contain a few rows, temporary tables, empty tables, and tables that have been created in the current transaction.

Warning: After crash recovery, the automatic analyze feature re-runs on tables with up-to-date statistics. This is because automatic analyze relies on up-to-date statistics from the PostgreSQL statistics collector, which are deleted during crash recovery.


swarm64da.enable_auto_analyze (boolean)

Enables or disables the auto analyze. The default is on.

swarm64da.auto_analyze_max_age (integer)

Sets the maximum age of table statistics. Tables with statistics older than this limit are analyzed automatically. The default is 10080 minutes, which is equal to one week.