{"id":711,"date":"2010-04-19T11:57:00","date_gmt":"2010-04-19T11:57:00","guid":{"rendered":"\/blogs\/paul\/post\/A-SQL-Server-DBA-myth-a-day-(1930)-TRUNCATE-TABLE-is-non-logged.aspx"},"modified":"2017-04-13T11:41:06","modified_gmt":"2017-04-13T18:41:06","slug":"a-sql-server-dba-myth-a-day-1930-truncate-table-is-non-logged","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/a-sql-server-dba-myth-a-day-1930-truncate-table-is-non-logged\/","title":{"rendered":"A SQL Server DBA myth a day: (19\/30) TRUNCATE TABLE is non-logged"},"content":{"rendered":"<p>(Look in the <a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/category\/misconceptions\/\">Misconceptions<\/a> blog category for the rest of the month&#8217;s posts and check out the 60-page PDF with all the myths and misconceptions blog posts collected together when you join our <a href=\"https:\/\/www.sqlskills.com\/join-the-sqlskills-insider-community\/\" target=\"_blank\">Insider list<\/a>.)<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">Today&#39;s myth is very persistent, so it&#39;s high time it was debunked with a nice script to prove it too!<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\"><font size=\"2\"><strong>Myth #19:<\/strong> <em>a TRUNCATE TABLE operation is non-logged<\/em>.<\/font><\/font>\n<\/p>\n<p>\n<strong><u><em><font face=\"verdana,geneva\" size=\"2\">FALSE<\/font><\/em><\/u><\/strong>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">There is no such thing as a non-logged operation in a user database. The only non-logged operations that SQL Server performs are those on the version store in tempdb.<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">A <font face=\"courier new,courier\">TRUNCATE TABLE<\/font>&nbsp;operation does a wholesale delete of all data in the table. The individual records are not deleted one-by-one, instead the data pages comprising the table are simply deallocated. The allocations are unhooked from the table and put onto a queue to be deallocated by a background task called the deferred-drop task. The deferred-drop task does the deallocations instead of them being done as part of the regular transaction so that no locks need to be acquired while deallocating entire extents. Before SQL Server 2000 SP3 (when this process was put into SQL Server), it was possible to run out of memory while acquiring locks during a <font face=\"courier new,courier\">TRUNCATE TABLE<\/font>&nbsp;operation.<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">Here&#39;s an example script:<\/font>\n<\/p>\n<blockquote>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">CREATE DATABASE TruncateTest;<br \/>\n\tGO<br \/>\n\tUSE TruncateTest;<br \/>\n\tGO<br \/>\n\tALTER DATABASE TruncateTest SET RECOVERY SIMPLE;<br \/>\n\tGO<br \/>\n\tCREATE TABLE t1 (c1 INT IDENTITY, c2 CHAR (8000) DEFAULT &#39;a&#39;);<br \/>\n\tCREATE CLUSTERED INDEX t1c1 on t1 (c1);<br \/>\n\tGO<\/font>\n\t<\/p>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">SET NOCOUNT ON;<br \/>\n\tGO<\/font>\n\t<\/p>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">INSERT INTO t1 DEFAULT VALUES;<br \/>\n\tGO 1280<\/font>\n\t<\/p>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">CHECKPOINT;<br \/>\n\tGO<\/font>\n\t<\/p>\n<\/blockquote>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">The database is in the <font face=\"courier new,courier\">SIMPLE<\/font> recovery mode so the log clears out on each checkpoint (for simplicity &#8211; ha ha :-)<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">Wait for a minute or so (there may be some ghost record cleanup that occurs) and check how many rows are in the log:<\/font>\n<\/p>\n<blockquote>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">SELECT COUNT (*) FROM fn_dblog (NULL, NULL);<br \/>\n\tGO<\/font>\n\t<\/p>\n<\/blockquote>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">If you don&#39;t get a result of 2, do another checkpoint and check the log record count again until it comes back at 2. Now the database is completely quiescent and any new log records are from stuff we&#39;re doing. Now we&#39;ll do the truncate:<\/font>\n<\/p>\n<blockquote>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">TRUNCATE TABLE t1;<br \/>\n\tGO<\/font>\n\t<\/p>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">SELECT COUNT (*) FROM fn_dblog (NULL, NULL);<br \/>\n\tGO<\/font>\n\t<\/p>\n<\/blockquote>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">I get back a result of 541 log records &#8211; clearly the operation is not non-logged, but it&#39;s clearly also not deleting each record &#8211; as I inserted 1280 records. If we look in the log we&#39;ll see:<\/font>\n<\/p>\n<blockquote>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">SELECT<br \/>\n\t&nbsp;[Current LSN], [Operation], [Context],<br \/>\n\t&nbsp;[Transaction ID], [AllocUnitName], [Transaction Name]<br \/>\n\tFROM fn_dblog (NULL, NULL);<br \/>\n\tGO<\/font>\n\t<\/p>\n<\/blockquote>\n<blockquote>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">Current LSN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Operation&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Context&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Transaction ID&nbsp; AllocUnitName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Transaction Name<br \/>\n\t&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&nbsp; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&nbsp; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&nbsp; &#8212;&#8212;&#8212;&#8212;&#8211;&nbsp; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&nbsp; &#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n\t00000081:000001a6:0016&nbsp; LOP_BEGIN_CKPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00000000&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL<br \/>\n\t00000081:000001a9:0001&nbsp; LOP_END_CKPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00000000&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL<br \/>\n\t00000081:000001aa:0001&nbsp; <strong>LOP_BEGIN_XACT<\/strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>0000:00001072<\/strong>&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>TRUNCATE TABLE<\/strong><br \/>\n\t00000081:000001aa:0002&nbsp; LOP_LOCK_XACT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001072&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL<br \/>\n\t00000081:000001aa:0003&nbsp; LOP_LOCK_XACT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001072&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL<br \/>\n\t00000081:000001aa:0004&nbsp; LOP_LOCK_XACT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001072&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL<br \/>\n\t00000081:000001aa:0005&nbsp; LOP_COUNT_DELTA&nbsp;&nbsp;&nbsp;&nbsp; LCX_CLUSTERED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00000000&nbsp;&nbsp; sys.sysallocunits.clust&nbsp;&nbsp;&nbsp;&nbsp; NULL<br \/>\n\t00000081:000001aa:0006&nbsp; LOP_COUNT_DELTA&nbsp;&nbsp;&nbsp;&nbsp; LCX_CLUSTERED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00000000&nbsp;&nbsp; sys.sysrowsets.clust&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL<br \/>\n\t00000081:000001aa:0007&nbsp; LOP_COUNT_DELTA&nbsp;&nbsp;&nbsp;&nbsp; LCX_CLUSTERED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00000000&nbsp;&nbsp; sys.sysrowsetcolumns.clust&nbsp; NULL<br \/>\n\t00000081:000001aa:0008&nbsp; LOP_COUNT_DELTA&nbsp;&nbsp;&nbsp;&nbsp; LCX_CLUSTERED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00000000&nbsp;&nbsp; sys.sysrowsetcolumns.clust&nbsp; NULL<br \/>\n\t00000081:000001aa:0009&nbsp; LOP_COUNT_DELTA&nbsp;&nbsp;&nbsp;&nbsp; LCX_CLUSTERED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00000000&nbsp;&nbsp; sys.sysrowsetcolumns.clust&nbsp; NULL<br \/>\n\t00000081:000001aa:000a&nbsp; LOP_HOBT_DDL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001072&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL<br \/>\n\t00000081:000001aa:000b&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_CLUSTERED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001072&nbsp;&nbsp; sys.sysallocunits.clust&nbsp;&nbsp;&nbsp;&nbsp; NULL<br \/>\n\t00000081:000001aa:000c&nbsp; LOP_MODIFY_COLUMNS&nbsp; LCX_CLUSTERED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001072&nbsp;&nbsp; sys.sysallocunits.clust&nbsp;&nbsp;&nbsp;&nbsp; NULL<br \/>\n\t00000081:000001aa:000d&nbsp; LOP_DELETE_ROWS&nbsp;&nbsp;&nbsp;&nbsp; LCX_MARK_AS_GHOST&nbsp;&nbsp; 0000:00001072&nbsp;&nbsp; sys.sysserefs.clust&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL<br \/>\n\t00000081:000001aa:000e&nbsp; LOP_MODIFY_HEADER&nbsp;&nbsp; LCX_PFS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00000000&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL<br \/>\n\t00000081:000001aa:000f&nbsp; LOP_SET_BITS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_PFS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00000000&nbsp;&nbsp; sys.sysserefs.clust&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL<br \/>\n\t00000081:000001aa:0010&nbsp; LOP_INSERT_ROWS&nbsp;&nbsp;&nbsp;&nbsp; LCX_CLUSTERED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001072&nbsp;&nbsp; sys.sysserefs.clust&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL<br \/>\n\t00000081:000001aa:0011&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_SCHEMA_VERSION&nbsp; 0000:00000000&nbsp;&nbsp; sys.sysobjvalues.clst&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL<br \/>\n\t00000081:000001aa:0012&nbsp; LOP_INSERT_ROWS&nbsp;&nbsp;&nbsp;&nbsp; LCX_CLUSTERED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001072&nbsp;&nbsp; sys.sysallocunits.clust&nbsp;&nbsp;&nbsp;&nbsp; NULL<br \/>\n\t00000081:000001aa:0013&nbsp; LOP_INSERT_ROWS&nbsp;&nbsp;&nbsp;&nbsp; LCX_CLUSTERED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001072&nbsp;&nbsp; sys.sysserefs.clust&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001aa:0014&nbsp; LOP_HOBT_DDL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001072&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001aa:0015&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_CLUSTERED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001072&nbsp;&nbsp; sys.sysrowsets.clust&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001aa:0016&nbsp; LOP_IDENT_SENTVAL&nbsp;&nbsp; LCX_NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001072&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001aa:0017&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_CLUSTERED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001072&nbsp;&nbsp; sys.syscolpars.clst&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001aa:0018&nbsp; <strong>LOP_COMMIT_XACT<\/strong>&nbsp;&nbsp;&nbsp;&nbsp; LCX_NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>0000:00001072<\/strong>&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0001&nbsp; <strong>LOP_BEGIN_XACT<\/strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>0000:00001073<\/strong>&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>DeferredAllocUnitDrop::Process<\/strong><br \/>\n\t00000081:000001b0:0002&nbsp; LOP_LOCK_XACT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0003&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0004&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_PFS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0005&nbsp; LOP_SET_BITS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_SGAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00000000&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0006&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0007&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_PFS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0008&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0009&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_PFS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:000a&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:000b&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_PFS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:000c&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:000d&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_PFS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:000e&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:000f&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_PFS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0010&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0011&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_PFS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0012&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0013&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_PFS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0014&nbsp; LOP_SET_BITS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_SGAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0015&nbsp; LOP_SET_BITS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_GAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0016&nbsp; LOP_SET_BITS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0017&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_PFS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0018&nbsp; LOP_SET_BITS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_GAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:0019&nbsp; LOP_SET_BITS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:001a&nbsp; LOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_PFS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:001b&nbsp; LOP_SET_BITS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_GAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\t00000081:000001b0:001c&nbsp; LOP_SET_BITS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000:00001073&nbsp;&nbsp; Unknown Alloc Unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL<br \/>\n\tetc<\/font>\n\t<\/p>\n<\/blockquote>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">The transaction with ID <font face=\"courier new,courier\">0000:00001072<\/font> is the implicit transaction of my <font face=\"courier new,courier\">TRUNCATE TABLE<\/font> statement (as you can see from the transaction name). It commits at LSN <font face=\"courier new,courier\">00000081:000001aa:0018<\/font> and then straight afterwards is the start of the deferred-drop transaction. As you can see from the log records, it&#39;s just deallocating the pages and extents.<\/font>\n<\/p>\n<p>\n<font size=\"2\"><font face=\"verdana,geneva\">Well, you can&#39;t really see that unless you know what all the log records are doing, so let&#39;s have a quick look at the descriptions:<\/font><\/font>\n<\/p>\n<blockquote>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">SELECT<br \/>\n\t&nbsp;[Current LSN], [Operation], [Lock Information], [Description]<br \/>\n\tFROM fn_dblog (NULL, NULL);<br \/>\n\tGO<\/font>\n\t<\/p>\n<\/blockquote>\n<p>\n<font size=\"2\">and you&#39;ll be able to see the locks that are logged to allow fast recovery to work (see my blog post <a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/lock-logging-and-fast-recovery\/\">Lock logging and fast recovery<\/a>&nbsp;for an in-depth explanation) and also the description of the operations being performed. Here&#39;s a small selection from the start of the deferred-drop transaction:<\/font>\n<\/p>\n<blockquote>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">Operation&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lock Information&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Description<br \/>\n\t&#8212;&#8212;&#8212;&#8212;&#8211;&nbsp; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&nbsp; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\tLOP_BEGIN_XACT&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DeferredAllocUnitDrop::Process<br \/>\n\tLOP_LOCK_XACT&nbsp;&nbsp; HoBt 0:ACQUIRE_LOCK_IX ALLOCATION_UNIT: 8:72057594042384384<br \/>\n\tLOP_MODIFY_ROW&nbsp; HoBt 72057594042384384:ACQUIRE_LOCK_X RID: 8:1:153:0<br \/>\n\tLOP_MODIFY_ROW&nbsp; HoBt 72057594042384384:ACQUIRE_LOCK_X PAGE: 8:1:152&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Deallocated 0001:00000098<br \/>\n\tLOP_MODIFY_ROW&nbsp; HoBt 72057594042384384:ACQUIRE_LOCK_X RID: 8:1:153:1<br \/>\n\tLOP_MODIFY_ROW&nbsp; HoBt 72057594042384384:ACQUIRE_LOCK_X PAGE: 8:1:156&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Deallocated 0001:0000009c<br \/>\n\tLOP_MODIFY_ROW&nbsp; HoBt 72057594042384384:ACQUIRE_LOCK_X RID: 8:1:153:2<br \/>\n\tLOP_MODIFY_ROW&nbsp; HoBt 72057594042384384:ACQUIRE_LOCK_X PAGE: 8:1:157&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Deallocated 0001:0000009d<br \/>\n\tLOP_MODIFY_ROW&nbsp; HoBt 72057594042384384:ACQUIRE_LOCK_X RID: 8:1:153:3<br \/>\n\tLOP_MODIFY_ROW&nbsp; HoBt 72057594042384384:ACQUIRE_LOCK_X PAGE: 8:1:158&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Deallocated 0001:0000009e<br \/>\n\tLOP_MODIFY_ROW&nbsp; HoBt 72057594042384384:ACQUIRE_LOCK_X RID: 8:1:153:4<br \/>\n\tLOP_MODIFY_ROW&nbsp; HoBt 72057594042384384:ACQUIRE_LOCK_X PAGE: 8:1:159&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Deallocated 0001:0000009f<br \/>\n\tLOP_MODIFY_ROW&nbsp; HoBt 72057594042384384:ACQUIRE_LOCK_X RID: 8:1:153:5<br \/>\n\tLOP_MODIFY_ROW&nbsp; HoBt 72057594042384384:ACQUIRE_LOCK_X PAGE: 8:1:160&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Deallocated 0001:000000a0<br \/>\n\tLOP_MODIFY_ROW&nbsp; HoBt 72057594042384384:ACQUIRE_LOCK_X RID: 8:1:153:6<br \/>\n\tLOP_MODIFY_ROW&nbsp; HoBt 72057594042384384:ACQUIRE_LOCK_X PAGE: 8:1:161&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Deallocated 0001:000000a1<br \/>\n\tLOP_MODIFY_ROW&nbsp; HoBt 72057594042384384:ACQUIRE_LOCK_X RID: 8:1:153:7<br \/>\n\tLOP_MODIFY_ROW&nbsp; HoBt 72057594042384384:ACQUIRE_LOCK_X PAGE: 8:1:162&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Deallocated 0001:000000a2<br \/>\n\tLOP_SET_BITS&nbsp;&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ClearBit 0001:000000a0<br \/>\n\tLOP_SET_BITS&nbsp;&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Deallocated 1 extent(s) starting at page 0001:000000a0<br \/>\n\tLOP_SET_BITS&nbsp;&nbsp;&nbsp; NULL<br \/>\n\tLOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Deallocated 0001:000000a8;Deallocated 0001:000000a9;Deallocated 0001:000000aa;Deallocated 0001:000000ab;Deallocated 0001:000000ac;Deallocated 0001:000000ad;Deallocated 0001:000000ae;Deallocated 0001:000000af<br \/>\n\tLOP_SET_BITS&nbsp;&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Deallocated 1 extent(s) starting at page 0001:000000a8<br \/>\n\tLOP_SET_BITS&nbsp;&nbsp;&nbsp; NULL<br \/>\n\tLOP_MODIFY_ROW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Deallocated 0001:000000b0;Deallocated 0001:000000b1;Deallocated 0001:000000b2;Deallocated 0001:000000b3;Deallocated 0001:000000b4;Deallocated 0001:000000b5;Deallocated 0001:000000b6;Deallocated 0001:000000b7 <\/font>\n\t<\/p>\n<\/blockquote>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">The first 8 operations are deallocating the 8&nbsp;pages that are allocated from mixed extents when the table&nbsp;was first populated and after that it switches to deallocating an entire extent at a time.&nbsp;Have a poke around &#8211; this stuff&#39;s really fascinating.&nbsp;Note also the <font face=\"courier new,courier\">LOP_LOCK_XACT<\/font> log record, which just describes the acquisition of a lock &#8211; not a change to the database. You&#39;ll notice that the extent deallocations don&#39;t have any locks protecting them &#8211; that&#39;s what the allocation unit IX lock is doing.<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">By the way, if you have nonclustered indexes on the table too, they are also dealt with the same way and there will be a single deferred-drop transaction which deallocates all the pages from both the table and all nonclustered indexes, one allocation unit at a time. Try it and you&#39;ll see what I mean.<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">Myth debunked!<\/font>\n<\/p>\n<p>\n<font size=\"2\">PS There&#39;s another myth that a <font face=\"courier new,courier\">TRUNCATE TABLE<\/font> can&#39;t be rolled back &#8211; I debunk that in this old blog post: <a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/search-engine-qa-10-when-are-pages-from-a-truncated-table-reused\/\">Search Engine Q&amp;A #10: When are pages from a truncated table reused?<\/a><\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\"><\/font><\/p>\n","protected":false},"excerpt":{"rendered":"<p>(Look in the Misconceptions blog category for the rest of the month&#8217;s posts and check out the 60-page PDF with all the myths and misconceptions blog posts collected together when you join our Insider list.) Today&#39;s myth is very persistent, so it&#39;s high time it was debunked with a nice script to prove it too! [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48,61,98],"tags":[],"class_list":["post-711","post","type-post","status-publish","format-standard","hentry","category-inside-the-storage-engine","category-misconceptions","category-transaction-log"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>A SQL Server DBA myth a day: (19\/30) TRUNCATE TABLE is non-logged - Paul S. Randal<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/a-sql-server-dba-myth-a-day-1930-truncate-table-is-non-logged\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"A SQL Server DBA myth a day: (19\/30) TRUNCATE TABLE is non-logged - Paul S. Randal\" \/>\n<meta property=\"og:description\" content=\"(Look in the Misconceptions blog category for the rest of the month&#8217;s posts and check out the 60-page PDF with all the myths and misconceptions blog posts collected together when you join our Insider list.) Today&#039;s myth is very persistent, so it&#039;s high time it was debunked with a nice script to prove it too! [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/a-sql-server-dba-myth-a-day-1930-truncate-table-is-non-logged\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2010-04-19T11:57:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-13T18:41:06+00:00\" \/>\n<meta name=\"author\" content=\"Paul Randal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Paul Randal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"19 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/a-sql-server-dba-myth-a-day-1930-truncate-table-is-non-logged\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/a-sql-server-dba-myth-a-day-1930-truncate-table-is-non-logged\/\",\"name\":\"A SQL Server DBA myth a day: (19\/30) TRUNCATE TABLE is non-logged - Paul S. Randal\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2010-04-19T11:57:00+00:00\",\"dateModified\":\"2017-04-13T18:41:06+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/a-sql-server-dba-myth-a-day-1930-truncate-table-is-non-logged\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/a-sql-server-dba-myth-a-day-1930-truncate-table-is-non-logged\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/a-sql-server-dba-myth-a-day-1930-truncate-table-is-non-logged\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"A SQL Server DBA myth a day: (19\/30) TRUNCATE TABLE is non-logged\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\",\"name\":\"Paul S. Randal\",\"description\":\"In Recovery...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\",\"name\":\"Paul Randal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"caption\":\"Paul Randal\"},\"sameAs\":[\"http:\/\/3.209.169.194\/blogs\/paul\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"A SQL Server DBA myth a day: (19\/30) TRUNCATE TABLE is non-logged - Paul S. Randal","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/paul\/a-sql-server-dba-myth-a-day-1930-truncate-table-is-non-logged\/","og_locale":"en_US","og_type":"article","og_title":"A SQL Server DBA myth a day: (19\/30) TRUNCATE TABLE is non-logged - Paul S. Randal","og_description":"(Look in the Misconceptions blog category for the rest of the month&#8217;s posts and check out the 60-page PDF with all the myths and misconceptions blog posts collected together when you join our Insider list.) Today&#39;s myth is very persistent, so it&#39;s high time it was debunked with a nice script to prove it too! [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/a-sql-server-dba-myth-a-day-1930-truncate-table-is-non-logged\/","og_site_name":"Paul S. Randal","article_published_time":"2010-04-19T11:57:00+00:00","article_modified_time":"2017-04-13T18:41:06+00:00","author":"Paul Randal","twitter_misc":{"Written by":"Paul Randal","Est. reading time":"19 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/a-sql-server-dba-myth-a-day-1930-truncate-table-is-non-logged\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/a-sql-server-dba-myth-a-day-1930-truncate-table-is-non-logged\/","name":"A SQL Server DBA myth a day: (19\/30) TRUNCATE TABLE is non-logged - Paul S. Randal","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2010-04-19T11:57:00+00:00","dateModified":"2017-04-13T18:41:06+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/a-sql-server-dba-myth-a-day-1930-truncate-table-is-non-logged\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/a-sql-server-dba-myth-a-day-1930-truncate-table-is-non-logged\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/a-sql-server-dba-myth-a-day-1930-truncate-table-is-non-logged\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"A SQL Server DBA myth a day: (19\/30) TRUNCATE TABLE is non-logged"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/","name":"Paul S. Randal","description":"In Recovery...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce","name":"Paul Randal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","caption":"Paul Randal"},"sameAs":["http:\/\/3.209.169.194\/blogs\/paul"],"url":"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/comments?post=711"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/711\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}