The time required to delete individual rows in a 在MyISAM
table is exactly proportional to the number of indexes. MyISAM
表中删除单个行所需的时间与索引数成正比。To delete rows more quickly, you can increase the size of the key cache by increasing the 要更快地删除行,可以通过增加key_buffer_size
system variable. key_buffer_size
系统变量来增加键缓存的大小。See Section 5.1.1, “Configuring the Server”.请参阅第5.1.1节,“配置服务器”。
To delete all rows from a 要删除MyISAM
table, TRUNCATE TABLE
is faster than tbl_name
DELETE FROM
. tbl_name
MyISAM
表中的所有行,TRUNCATE TABLE
比tbl_name
DELETE FROM
快。tbl_name
Truncate operations are not transaction-safe; an error occurs when attempting one in the course of an active transaction or active table lock. 截断操作不是事务安全的;在活动事务或活动表锁定过程中尝试一个时出错。See Section 13.1.37, “TRUNCATE TABLE Statement”.请参阅第13.1.37节,“截断表语句”。