上官方网站看了下 v5.1 优化表一章, 里面正好有提到遇到的问题:
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:
[sql]
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 |
+----------+----------+----------+-------------------------------------------------------------------+
[/sql]
It is because the table that you are using is InnoDB.
You can optimize the InnoDB tables by using this.
[sql]
ALTER TABLE table.name ENGINE='InnoDB';
[/sql]
You can make OPTIMIZE TABLE work on other storage engines by starting mysqld with the--skip-newor--safe-modeoption. In this case, OPTIMIZE TABLE is just mapped to ALTER TABLE.
注:
[bash]
[root@localhost ~]# /usr/local/mysql/libexec/mysqld --verbose --help
[/bash]
结果中有对
--skip-new 和 --safe-mode选项的描述--skip-newDon't use new, possible wrong routines.--safe-modeSkip some optimize stages (for testing).
没有评论 :
发表评论