Differences Between TRUNCATE TABLE and DELETE

If you want to remove data from a table, you can do this in a couple of ways using TRUNCATE TABLE or DELETE. A common approach is to use DELETE to remove all rows in the table but TRUNCATE TABLE offers an alternative and I will list what the differences between the two are.


--Delete rows with filter
DELETE FROM SchemaName.Table WHERE...

--Delete all rows
DELETE SchemaName.Table

--Delete all rows
DELETE FROM SchemaName.Table

--Delete using JOINS
FROM SchemaName.Table1 AS T1
JOIN SchemaName.Table2 AS T2 ON T1.Column1 = T2.Column1

--Delete using IN
DELETE FROM SchemaName.Table1
WHERE Column1 IN (SELECT Column1 FROM SchemaName.Table2)

--Delete using EXISTS
FROM SchemaName.Table1 AS T1
FROM SchemaName.Table2 AS T2
WHERE T1.Column1 = T2.Column1)

  • Provides more control over what data is and can be deleted.
  • Will not reseed the identity value on an identity column
  • Can be used where the DELETE operation does not violate foreign key constraint
  • Can be a slow operation if the table is large
  • Locking can be an issue if the operation is removing many rows
  • Will fire triggers
  • Transactions can be rolled back as LSN (log sequence number) is maintained in the transaction log
  • Data pages consumed may need to be reclaimed using a DBCC SHRINKDATABASE operation
  • DELETE will typically consume more transaction log space because of extra logging


TRUNCATE TABLE Schema.TableName;

  • WHERE clause is not optional – it will remove all data from your table
  • Reseeds the identify value of an identity column
  • Cannot be used on a table which is referenced by a foreign key constraint
  • Can be considerably quicker than DELETE due to deallocation of data pages and minimal logging
  • Cannot be used in replication or log shipping
  • Will not fire triggers
  • Cannot be used on tables which are part of an indexed view
  • Who has permission: table owner, sysadmin, db_owner, db_ddladmin or any user with ALTER permission on the table

I wanted to expand on the differences in speed between the two operations.

When TRUNCATE TABLE is issued against a table, all the data pages are deallocated which are used to store the tables data. Compared with a DELETE, this is significantly faster as each DELETE operation is logged in the transaction log but only the deallocations are logged in the transaction log for a TRUNCATE operation.

The DELETE operation will consume database resource and locks and can therefore be considerably slower and have greater impact on your system in comparison to TRUNCATE TABLE. See this post on reducing overhead for large delete operations.

As each DELETE operation is logged inside of the transaction log, it is possible to rollback to a point in time but with TRUNCATE TABLE it is not possible to have this level of precision. In a rollback scenario, only a complete rollback could be performed.

As with a DELETE it is also possible to rollback a TRUNCATE if it has not yet been committed. You can do this by using transactions like in this very simple example:

--test success here

Time to wrap this up..

So there are a number of differences between the two. Both operations have their pros and cons and provide you with a choice over how you want to remove your data.


It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInPin on PinterestBuffer this pageShare on RedditShare on StumbleUpon
About Andy Hayes

Andy Hayes is a DBA working with SQL Server since version 7.0. He has a wonderful wife and two beautiful children. He loves database technology, playing cricket, and blogging. He is passionate about sharing his experiences as a DBA and learning more to further his understanding and knowledge. You can follow me on Twitter, check out my Facebook page or follow me on


  1. Wonderful comparison of two, I have also shared couple of tips on this topic as http://java67.blogspot.hk/2013/07/difference-between-truncate-vs-delete-SQL-Command-database-interview-question.html. When to use truncate vs delete in database, programmer may find it useful.

Speak Your Mind