DELETE、TRUNCATE和DROP

effect

DELETE

delete a data manipulation language, you can delete the table where records specified in the statement, reserved table structure, not free up storage space.
DELETE、TRUNCATE和DROP

TRUNCATE

truncate data definition language, empty table, which is equivalent to delete all the data in the table, reserved table structure, free up storage space.
DELETE、TRUNCATE和DROP

DROP

drop is a data definition language, when you delete, erase all records in the table and delete the table structure, free up storage space.
DELETE、TRUNCATE和DROP

Value Line Efficiency

drop > truncate > delete

Affairs

DELETE

Before uncommitted transaction, use rollback transaction rollback.

TRUNCATE

Implicit transaction is committed, you can not use rollback transaction rollback.

DROP

Implicit transaction is committed, you can not use rollback transaction rollback.

Reference material

https://xiaozhuanlan.com/topic/6375814029
https://juejin.im/post/5dc03bca6fb9a04aa00147d6

Guess you like

Origin blog.51cto.com/13646338/2450123