zoukankan      html  css  js  c++  java
  • MySQL索引统计信息更新相关的参数

    MySQL统计信息相关的参数:

      1. innodb_stats_on_metadata(是否自动更新统计信息),MySQL 5.7中默认为关闭状态

        仅在统计信息配置为非持久化的时候生效。
        也就是说在innodb_stats_persistent 配置为OFF的时候,非持久化存储统计信息的手,innodb_stats_on_metadata的设置才生效。
        当innodb_stats_on_metadata设置为ON的时候,
        InnoDB在执show table status 或者访问INFORMATION_SCHEMA.TABLES 或者INFORMATION_SCHEMA.STATISTICS 系统表的时候,更新费持久化统计信息(类似于ANALYZE TABLE)

        某个索引的统计信息更新时间参考mysql.innodb_index_stats这个系统表
        select * from mysql.innodb_index_stats  where table_name = 'teststatistics';

      2. innodb_stats_auto_recalc

        是否自动触发更新统计信息,仅影响持久化存储的统计信息的表,阈值是变化的数据超过表行数的10%。
        也就是说,一个表索引统计信息是持久化存储的,并且表中数据变化了超过10%,
        如果innodb_stats_auto_recalc为ON,就会自动更新统计信息,否则不更

      3. innodb_stats_persistent(非持久化统计信息开关),MySQL 5.7中默认为打开,持久化存储统计信息

        该选项设置为ON时候,统计信息会持久化存储到磁盘中,而不是存在在内存中,
        相反,如果是非持久化存储的(存在内存中),相应的统计信息会随着服务器的关闭而丢失。

      4. innodb_stats_persistent_sample_pages (持久化更新统计信息时候索引页的取样页数)

        默认是20个page,如果设置的过高,那么在更新统计信息的时候,会增加ANALYZE TABLE的执行时间。

      5. innodb_stats_transient_sample_pages(临时性更新统计信息时候索引页的取样页数)

        默认值是8,innodb_stats_persistent设置为disable的情况下innodb_stats_transient_sample_pages才生效,
        也就是非持久化存储过索引统计信息的时候,innodb_stats_transient_sample_pages为更新统计信息的采样页数

      6. innodb_stats_sample_pages

        已弃用. 已用innodb_stats_transient_sample_pages 替代。
     

  • 相关阅读:
    数据库范式
    SQL--使用NewID函数,创建GUID列
    初学Python
    Artificial intelligence(AI)
    Concurrency in csharp (Asynchronous, Parallel, and Multithreaded Programming)
    MySQL 5.7 create VIEW or FUNCTION or PROCEDURE
    csharp: Oracle Stored Procedure DAL using ODP.NET
    csharp: ODP.NET,System.Data.OracleClient(.net 4.0) and System.Data.OleDb读取Oracle g 11.2.0的区别
    csharp:ASP.NET SignalR
    csharp: MySQL Stored Procedure using DAL
  • 原文地址:https://www.cnblogs.com/phpper/p/6592831.html
Copyright © 2011-2022 走看看