繁体   English   中英

MySQL 碎片整理 InnoDB 表

[英]MySQL defragment InnoDB tables

运行mysqltuner后,我收到了这个输出:

Total fragmented tables: 284

为了进行碎片整理,我尝试了这些:

1. ALTER TABLE tbl_name ENGINE=INNODB
2. Another way to perform a defragmentation operation is to use mysqldump to dump the table to a text file, drop the table, and reload it from the dump file.

这两种方法在MySQL 文档中都有描述。

但是这些方法都没有帮助。 Mysqltuner 仍然说表是碎片化的。

注意: innodb_file_per_table在我的配置中是关闭的。

如何对 InnoDB 表进行碎片整理?

更改表 tbl_name 引擎 = INNODB

是对 innodb 表进行碎片整理的唯一方法。

ALGORITHM=INPLACE 可以帮我们在线做。

从 MySQL 5.5.11 开始,您还可以使用ALTER TABLE tbl_name FORCE来执行重建表的“空”更改操作。 以前 FORCE 选项被识别但被忽略。

https://dev.mysql.com/doc/refman/5.5/en/alter-table.html

我遇到了同样的问题,对我有用的解决方案是在alter之后进行analyze

alter table xyz engine=InnoDB;
analyze table xyz;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM