Truncate and Delete are two database operations that can be used to remove data from a table. While both of these commands have the same end result, there are some key differences between them that should be taken into consideration when deciding which operation is best for your needs. In this article, we will discuss the differences between Truncate and Delete and explain why one might be preferable over the other.
About Difference Between Truncate And Delete
|Removes all rows from a table quickly||Deletes specific row(s) from a table|
|Faster than delete||Slower than truncate|
|Cannot use WHERE condition||Can use WHERE condition to specify which rows to delete|
|Automatically resets the identity of the table||Does not reset the identity of the table|
|Not possible to rollback once executed||Possible to rollback if used with transactions|
|Log file is not created||Log file is created for deleted records|