The difference between truncate and delete

TRUNCATE TABLE is functionally identical to the DELETE statement without the WHERE clause: both delete all rows in the table. But TRUNCATE TABLE is faster than DELETE and uses less system and transaction log resources. The DELETE statement deletes one row at a time and records an entry in the transaction log for each row deleted.
TRUNCATE TABLE deletes data by freeing the data pages used to store the table data, and only records the freeing of pages in the transaction log.
TRUNCATE, DELETE, DROP put together to compare:
TRUNCATE TABLE: delete content, release space but not delete the definition.
DELETE TABLE: Deleting content does not delete definitions and does not release space.
DROP TABLE: Delete content and definitions to free up space.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326354334&siteId=291194637