Home  >  Article  >  Database  >  REPAIR TABLE和OPTIMIZE TABLE优化表和修复表_MySQL

REPAIR TABLE和OPTIMIZE TABLE优化表和修复表_MySQL

WBOY
WBOYOriginal
2016-06-01 13:56:49928browse

REPAIR TABLE `table_name` 修复表

OPTIMIZE TABLE `table_name` 优化表

REPAIR TABLE 用于修复被破坏的表。

OPTIMIZE TABLE 用于回收闲置的数据库空间,

当表上的数据行被删除时,所占据的磁盘空间并没有立即被回收,使用了OPTIMIZE TABLE命令后这些空间将被回收,并且对磁盘上的数据行进行重排(注意:是磁盘上,而非数据库)。

多数时间并不需要运行OPTIMIZE TABLE,只需在批量删除数据行之后,或定期(每周一次或每月一次)进行一次数据表优化操作即可,只对那些特定的表运行。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn