MySQL :: MySQL 8.0 Reference Manual :: 10.2.5.3 Optimizing DELETE Statements (original) (raw)

10.2.5.3 Optimizing DELETE Statements

The time required to delete individual rows in aMyISAM table is exactly proportional to the number of indexes. To delete rows more quickly, you can increase the size of the key cache by increasing thekey_buffer_size system variable. See Section 7.1.1, “Configuring the Server”.

To delete all rows from a MyISAM table,TRUNCATE TABLE_`tblname`_ is faster thanDELETE FROM_`tblname`_. 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 15.1.37, “TRUNCATE TABLE Statement”.