MySQL index statistics update related parameters

Source: Internet
Author: User
Tags mysql index

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.