8.2.5.3 Optimizing DELETE Statements优化DELETE语句

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 tbl_name is faster than DELETE FROM tbl_name. 要删除MyISAM表中的所有行,TRUNCATE TABLE tbl_nameDELETE 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节,“截断表语句”