Truncate operations drop and re-create the table, which is much faster than deleting rows one by one, particularly for large tables.
As of MySQL 4.1.13, truncate operations cause an implicit commit. Before 4.1.13, truncate operations are not transaction-safe; an error occurs when attempting one in the course of an active transaction.
Truncation operations cannot be performed if the session holds an active table lock.
Truncation operations do not return a meaningful value for the number of deleted rows. The usual result is “0 rows affected,” which should be interpreted as “no information.”
As long as the table format file
is valid, the table can be re-created as an empty table with
TRUNCATE TABLE, even if the
data or index files have become corrupted.
The table handler does not remember the last used
AUTO_INCREMENT value, but starts counting
from the beginning. This is true even for
normally do not reuse sequence values. (Some older versions
may not reset the
AUTO_INCREMENT value. In
this case, you can use
TRUNCATE TABLE was added in MySQL
3.23.28, although from 3.23.28 to 3.23.32, the keyword
TABLE must be omitted.