Empty all contents of a mysql table

delete from table name;
truncate table table name;
the delete statement without the where parameter can delete all the content in the mysql table, and use truncate table to clear all the content in the mysql table. In terms of efficiency, truncate is faster than delete, but mysql log is not recorded after truncate is deleted, and data cannot be recovered.
The effect of delete is a bit like deleting all the records in the mysql table one by one until the deletion is complete, and truncate is equivalent to retaining the structure of the mysql table, re-creating the table, and all the states are equivalent to the new table.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=324081513&siteId=291194637