zoukankan      html  css  js  c++  java
  • MySQL: OPTIMIZE TABLE: Table does not support optimize, doing recreate + analyze instead

    show create table history;
    --------------------------
    CREATE TABLE `foo` (
      `itemid` bigint(20) unsigned NOT NULL,
      `clock` int(11) NOT NULL DEFAULT '0',
      `value` double(16,4) NOT NULL DEFAULT '0.0000',
      `ns` int(11) NOT NULL DEFAULT '0',
      KEY `history_1` (`itemid`,`clock`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8

    mysql> OPTIMIZE TABLE history;
    +----------+----------+----------+-------------------------------------------------------------------+ | Table | Op | Msg_type | Msg_text | +----------+----------+----------+-------------------------------------------------------------------+ | test.foo | optimize | note | Table does not support optimize, doing recreate + analyze instead | | test.foo | optimize | status | OK | +----------+----------+----------+-------------------------------------------------------------------+



    这里mysql给的提示是
    Note>> Table does not support optimize, doing recreate + analyze instead 
    Status>> OK
    也就是说 optimize table 对于innodb来说,无法作为
    a single operation,实际的操作是:
    ALTER TABLE test.foo ENGINE=InnoDB;
    ANALYZE TABLE test.foo;
    

       MySQL5.7已经推荐对于InnoDB的table使用 alter table table_name engine=innodb;语句的方式来进行表碎片优化。

      底层实现的不同,参考:https://dev.mysql.com/doc/refman/5.7/en/optimize-table.html



  • 相关阅读:
    1061. 判断题(15)
    1031. 查验身份证(15)
    1006. 换个格式输出整数 (15)
    1046. 划拳(15)
    1001. 害死人不偿命的(3n+1)猜想 (15)
    1021. 个位数统计 (15)
    1054. 求平均值 (20)
    写出这个数 (20)
    设计模式之中介者模式
    kill命令
  • 原文地址:https://www.cnblogs.com/DataArt/p/9989360.html
Copyright © 2011-2022 走看看