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



  • 相关阅读:
    最舒适的路线(并查集)
    POJ 2411 状态压缩DP
    NYOJ 708 ones
    HUD 1024 Max Sum Plus Plus
    最长上升子序列
    HDU 4717 The Moving Points
    重新开始写随笔
    读书的意义
    读《如何阅读一本书》笔记
    读《GRAY HAT PYTHON》笔记
  • 原文地址:https://www.cnblogs.com/DataArt/p/9989360.html
Copyright © 2011-2022 走看看