以 discuz 论坛的帖子数据表(cdb_posts)为例,该表有 887106 条记录,正常情况下,在一个 P4 2.4G、1G 内存的 PC 机上执行 REPAIR TABLE 的耗时大概 95s,如下:
mysql> SHOW GLOBAL VARIABLES LIKE 'myisam_repair_threads'; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ | myisam_repair_threads | 1 | +-----------------------+-------+ mysql> REPAIR TABLE cdb_posts; +-----------------+--------+----------+----------+ | Table | Op | Msg_type | Msg_text | +-----------------+--------+----------+----------+ | Forum.cdb_posts | repair | status | OK | +-----------------+--------+----------+----------+ 1 row in set (1 min 35.58 sec)
mysql> SHOW GLOBAL VARIABLES LIKE 'myisam_repair_threads'; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ | myisam_repair_threads | 2 | +-----------------------+-------+ mysql> REPAIR TABLE cdb_posts;
mysql> SHOW PROCESSLIST; .... | 1 | root | localhost | Forum | Query | 1330 | Repair with 7 threads | REPAIR TABLE cdb_posts | ....