Recently in the blockchain to make a token of the app, involving the database table in the deletion of records, if a strip delete that is really tiring. Consider directly entering MySQL directly to empty the table or delete the data in the table.
This article records the difference between the 2 modes of operation, the target object is the table wp_comments, all the messages inside are spam messages, can be deleted. Then there are 2 ways to do it (after entering the MySQL interface):
- TRUNCATE TABLE wp_comments;
- Delete * from wp_comments;
Where the table in the truncate operation can be omitted, the * in the delete operation can be omitted. Both of these are emptying the data in the Wp_comments table, but there are also differences, as follows:
- Truncate is the overall deletion (faster), delete is deleted one by one (slower).
- Truncate does not write server Log,delete write server log, that is, truncate efficiency than delete high reason.
- Truncate does not activate the trigger (trigger), but resets the identity (identity column, self-increment field), which is equivalent to the self-increment column being set to the initial value, and again starting from 1, rather than the number of previous IDs. When delete is deleted, the identity is still recorded after the last record ID plus 1 that was deleted.
- If you only need to delete some of the records in the table, you can only use the DELETE statement with the Where condition. DELETE from Wp_comments WHERE ...
The difference between the MySQL purge table (truncate) and the data (delete) in the Delete table