Parameters related to MySQL statistics:
1. Innodb_stats_on_metadata (whether statistics are automatically updated), the default is off in MySQL 5.7
Takes effect only when the statistics are configured as non-persistent.
That is, when the innodb_stats_persistent is configured to OFF, the Innodb_stats_on_metadata's settings are not valid until the hand that stores the statistics is persisted.
When Innodb_stats_on_metadata is set to ON,
InnoDB is holding the show table status or visiting information_schema. TABLES or INFORMATION_SCHEMA. Update fee persistence statistics (similar to analyze table) when STATISTICS system tables
Statistics update time for an index reference mysql.innodb_index_stats this system table
SELECT * FROM mysql.innodb_index_stats WHERE table_name = ' teststatistics ';
2. Innodb_stats_auto_recalc
Whether to automatically trigger update statistics, only the table that affects the persisted stored statistics, the threshold value is 10% of the changed data over the number of table rows.
That is, a table index statistic is persisted and the data in the table changes by more than 10%.
If Innodb_stats_auto_recalc is on, statistics are automatically updated or not
3. Innodb_stats_persistent (non-persistent statistics switch), MySQL 5.7 default to open, persist storage statistics
When this option is set to on, statistics are persisted to disk instead of being in memory.
Conversely, if the storage is non-persistent (in memory), the corresponding statistics are lost as the server shuts down.
4. Innodb_stats_persistent_sample_pages (number of pages on index page when persisting update statistics)
The default is 20 page, if the setting is too high, then when the statistics are updated, the execution time of analyze table will be increased.
5. Innodb_stats_transient_sample_pages (sample pages for index pages when updating statistics temporarily)
The default value is 8,innodb_stats_persistent is set to disable, Innodb_stats_transient_sample_pages takes effect.
That is, when the index statistics are stored in non-persisted, the innodb_stats_transient_sample_pages is the number of pages to update the statistics.
6. Innodb_stats_sample_pages
is deprecated. Replaced with Innodb_stats_transient_sample_pages.
MySQL index statistics update related parameters