zoukankan      html  css  js  c++  java
  • analyze table

    # desc endpoint;
    # show create table endpoint G;
    # show index  from endpoint  G;
    # show table status like 'endpoint'G;
    # optimize table endpoint G;
    # alter table endpoint engine='InnoDB';   
    # check table endpoint;
    # analyze table endpoint;
    MySQL中analyze table的作用是?生产上操作会有什么风险?
    
    
    一、analyze table的作用
        1、analyze table 会统计索引分布信息。
        2、对于 MyISAM 表,相当于执行了一次 myisamchk --analyze
        3、支持 InnoDB、NDB、MyISAM 等存储引擎,但不支持视图(view)
        4、执行 analyze table 时,会对表加上读锁(read lock)
        5、该操作会记录binlog
    
    
    
    二、生产上操作的风险
        1、analyze table的需要扫描的page代价粗略估算公式:sample_pages * 索引数 * 表分区数。
        2、因此,索引数量较多,或者表分区数量较多时,执行analyze table可能会比较费时,要自己评估代价,并默认只在负载低谷时执行。
        3、特别提醒,如果某个表上当前有慢SQL,此时该表又执行analyze table,则该表后续的查询均会处于waiting for table flush的状态,严重的话会影响业务,因此执行前必须先检查有无慢查询。
    
    备注:上面多次提到MyISAM,仅是本次总结所需,并不推荐大家使用MyISAM引擎,使用InnoDB才是正道。
  • 相关阅读:
    bootstrap
    Bootstrap面试题
    h5+css3 考试题
    less安装与使用
    css3(四)响应式 Web 设计 - 媒体查询
    css3(三)弹性布局
    css3(三)多列布局
    JavaScriptAPI初识
    Bootstrap面试题
    BS初识
  • 原文地址:https://www.cnblogs.com/igoodful/p/13570312.html
Copyright © 2011-2022 走看看