15.8.10.1 Configuring Persistent Optimizer Statistics Parameters

The persistent optimizer statistics feature improves plan stability by storing statistics to disk and making them persistent across server restarts so that the optimizer is more likely to make consistent choices each time for a given query.

Optimizer statistics are persisted to disk when innodb_stats_persistent=ON or when individual tables are defined with STATS_PERSISTENT=1. innodb_stats_persistent is enabled by default.

Formerly, optimizer statistics were cleared when restarting the server and after some other types of operations, and recomputed on the next table access. Consequently, different estimates could be produced when recalculating statistics leading to different choices in query execution plans and variation in query performance.

Persistent statistics are stored in the mysql.innodb_table_stats and mysql.innodb_index_stats tables. See Section 15.8.10.1.5, “InnoDB Persistent Statistics Tables”.

If you prefer not to persist optimizer statistics to disk, see Section 15.8.10.2, “Configuring Non-Persistent Optimizer Statistics Parameters”

15.8.10.1.1 Configuring Automatic Statistics Calculation for Persistent Optimizer Statistics
15.8.10.1.2 Configuring Optimizer Statistics Parameters for Individual Tables
15.8.10.1.3 Configuring the Number of Sampled Pages for InnoDB Optimizer Statistics
15.8.10.1.4 Including Delete-marked Records in Persistent Statistics Calculations
15.8.10.1.5 InnoDB Persistent Statistics Tables
15.8.10.1.6 InnoDB Persistent Statistics Tables Example
15.8.10.1.7 Retrieving Index Size Using the innodb_index_stats Table