MySQL整理碎片

1 innodb引擎表

alter table TABLE_NAME engine='innodb';

还有一种方法

optiize table TABLE_NAME;

http://stackoverflow.com/questions/30635603/what-does-table-does-not-support-optimize-doing-recreate-analyze-instead-me

后边的这种方法在对innodb做碎片整理时,会出现

uk.uuu
note     : Table does not support optimize, doing recreate + analyze instead
status   : OK

官方解释:For InnoDB tables, OPTIMIZE TABLE is mapped to ALTER TABLE ... FORCE, which rebuilds the table to update index statistics and free unused space in the clustered index. This is displayed in the output of OPTIMIZE TABLE when you run it on an InnoDB table, as shown here:

http://dev.mysql.com/doc/refman/5.7/en/optimize-table.html

原文地址:https://www.cnblogs.com/HarveyBing/p/5820610.html