All pages
Powered by GitBook
1 of 1

Loading...

InnoDB Persistent Statistics

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.

See Also

This page is licensed: CC BY-SA / Gnu FDL

innodb_stats_persistent_sample_pages
ANALYZE TABLE
STATS_PERSISTENT
STATS_AUTO_RECALC
STATS_SAMPLE_PAGES
CREATE TABLE
ALTER TABLE
mysql database
innodb_table_stats
innodb_index_stats
ANALYZE TABLE
RENAME TABLE
10.11.12
MariaDB 10.11.12
MariaDB 11.4.6
MariaDB 11.8.2
FLUSH TABLES
MariaDB 10.11.12
MariaDB 11.4.6
MariaDB 11.8.2
Index Statistics
Engine-independent Statistics
Histogram-based Statistics
MariaDB 10.0