今天做实验用optimize table 时发现
Table Op Msg_type Msg_textusers.user optimize note Table does not support optimize, doing recreate + ...users.user optimize status OK
纳尼居然不支持optimize?!众所周知optimize对myisam和innodb表来说是很重要的优化手段,我的innodb表怎么会不支持optimize呢?让我来一探究竟。
手册是这么说的:
For InnoDB tables, OPTIMIZE TABLE is mapped to ALTER TABLE, which rebuilds the table to update index statistics and free unused space in the clustered index. Beginning with MySQL 5.1.27, this is displayed in the output of OPTIMIZE TABLE when you run it on an InnoDB table, as shown here:mysql> OPTIMIZE TABLE foo;+----------+----------+----------+-------------------------------------------------------------------+| Table | Op | Msg_type | Msg_text |+----------+----------+----------+-------------------------------------------------------------------+| test.foo | optimize | note | Table does not support optimize, doing recreate + analyze instead || test.foo | optimize | status | OK |+----------+----------+----------+-------------------------------------------------------------------+
呀,原来我这是正常情况呀,对于5.5版本的mysql来说innodb表进行optimize是这种显示的。