InnoDB statistics are stored on disk and are therefore persistent. Prior to , InnoDB statistics were not stored on disk, meaning that on server restarts the statistics would need to be recalculated, which is both needless computation, as well as leading to inconsistent query plans.
There are a number of variables that control persistent statistics:
innodb_stats_persistent - when set (the default) enables InnoDB persistent statistics.
innodb_stats_auto_recalc - when set (the default), persistent statistics are automatically recalculated when the table changes significantly (more than 10% of the rows)
- Number of index pages sampled (default 20) when estimating cardinality and statistics for indexed columns. Increasing this value will increases index statistics accuracy, but use more I/O resources when running .
These settings can be overwritten on a per-table basis by use of the , and clauses in a or statement.
Details of the statistics are stored in two system tables in the :
The statement can be used to recalculate InnoDB statistics.
The statement triggers a reload of the statistics.
MariaDB starting with
Prior to , and , also caused InnoDB statistics to be reloaded. From , and , this is no longer the case.
This page is licensed: CC BY-SA / Gnu FDL