{"id":1112,"date":"2007-12-31T20:53:00","date_gmt":"2007-12-31T20:53:00","guid":{"rendered":"\/blogs\/paul\/post\/Inside-the-Storage-Engine-When-do-versioning-tags-get-added.aspx"},"modified":"2007-12-31T20:53:00","modified_gmt":"2007-12-31T20:53:00","slug":"inside-the-storage-engine-when-do-versioning-tags-get-added","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/inside-the-storage-engine-when-do-versioning-tags-get-added\/","title":{"rendered":"Inside the Storage Engine: When do versioning tags get added?"},"content":{"rendered":"<p><FONT face=Verdana><FONT size=2><br \/>\n<P>Ok &#8211; so we did more partying than we thought so blog posts have been a little sparse this month, but here&#8217;s one to end off the year.<\/P><br \/>\n<P>There&#8217;s a popular impression that turning on snapshot isolation and then rebuilding indexes will cause all rows in the table to get the extra 14-byte versioning tags. Fact or fiction? Let&#8217;s find out.<\/P><br \/>\n<P>First I&#8217;ll create a test database, containing a small table with a clustered index and few rows:<\/P><FONT color=#0000ff size=2><br \/>\n<BLOCKQUOTE dir=ltr style=\"MARGIN-RIGHT: 0px\"><br \/>\n<P><FONT face=\"Courier New\">CREATE<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> <\/FONT><FONT color=#0000ff size=2>DATABASE<\/FONT><FONT color=#000000 size=2> SItest<\/FONT><FONT color=#808080 size=2>;<BR><\/FONT><\/FONT><FONT face=\"Courier New\" size=2>GO<\/P><\/FONT><FONT color=#0000ff size=2><br \/>\n<P><FONT face=\"Courier New\">USE<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> SItest<\/FONT><FONT color=#808080 size=2>;<BR><\/FONT><\/FONT><FONT face=\"Courier New\" size=2>GO<\/P><\/FONT><FONT color=#0000ff size=2><br \/>\n<P><FONT face=\"Courier New\">CREATE<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> <\/FONT><FONT color=#0000ff size=2>TABLE<\/FONT><FONT color=#000000 size=2> SmallTable <\/FONT><FONT color=#808080 size=2>(<\/FONT><FONT color=#000000 size=2>c1 <\/FONT><FONT color=#0000ff size=2>INT<\/FONT><FONT color=#808080 size=2>,<\/FONT><FONT color=#000000 size=2> c2 <\/FONT><FONT color=#0000ff size=2>INT<\/FONT><FONT color=#808080 size=2>);<BR><\/FONT><\/FONT><FONT color=#0000ff size=2><FONT face=\"Courier New\">CREATE<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> <\/FONT><FONT color=#0000ff size=2>CLUSTERED<\/FONT><FONT color=#000000 size=2> <\/FONT><FONT color=#0000ff size=2>INDEX<\/FONT><FONT color=#000000 size=2> SmallTableCI <\/FONT><FONT color=#0000ff size=2>ON<\/FONT><FONT color=#000000 size=2> SmallTable <\/FONT><FONT color=#808080 size=2>(<\/FONT><FONT color=#000000 size=2>c1<\/FONT><FONT color=#808080 size=2>);<BR><\/FONT><\/FONT><FONT face=\"Courier New\" size=2>GO<\/P><\/FONT><FONT color=#0000ff size=2><br \/>\n<P><FONT face=\"Courier New\">INSERT<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> <\/FONT><FONT color=#0000ff size=2>INTO<\/FONT><FONT color=#000000 size=2> SmallTable <\/FONT><FONT color=#0000ff size=2>VALUES<\/FONT><FONT color=#000000 size=2> <\/FONT><FONT color=#808080 size=2>(<\/FONT><FONT color=#000000 size=2>1<\/FONT><FONT color=#808080 size=2>,<\/FONT><FONT color=#000000 size=2> 1<\/FONT><FONT color=#808080 size=2>);<BR><\/FONT><\/FONT><FONT color=#0000ff size=2><FONT face=\"Courier New\">INSERT<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> <\/FONT><FONT color=#0000ff size=2>INTO<\/FONT><FONT color=#000000 size=2> SmallTable <\/FONT><FONT color=#0000ff size=2>VALUES<\/FONT><FONT color=#000000 size=2> <\/FONT><FONT color=#808080 size=2>(<\/FONT><FONT color=#000000 size=2>2<\/FONT><FONT color=#808080 size=2>,<\/FONT><FONT color=#000000 size=2>2<\/FONT><FONT color=#808080 size=2>);<BR><\/FONT><\/FONT><FONT size=2><FONT face=\"Courier New\">GO<\/FONT><\/P><\/BLOCKQUOTE><\/FONT><br \/>\n<P>Next I&#8217;ll turn on <FONT face=\"Courier New\">READ_COMMITTED_SNAPSHOT<\/FONT> and rebuild the index to see if statement level versioning does the trick:<\/P><br \/>\n<BLOCKQUOTE dir=ltr style=\"MARGIN-RIGHT: 0px\"><FONT color=#0000ff size=2><br \/>\n<P><FONT face=\"Courier New\">ALTER<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> <\/FONT><FONT color=#0000ff size=2>DATABASE<\/FONT><FONT color=#000000 size=2> SItest <\/FONT><FONT color=#0000ff size=2>SET<\/FONT><FONT color=#000000 size=2> <\/FONT><FONT color=#0000ff size=2>READ_COMMITTED_SNAPSHOT<\/FONT><FONT color=#000000 size=2> <\/FONT><FONT color=#0000ff size=2>ON<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#808080 size=2>;<BR><\/FONT><FONT size=2>GO<\/P><\/FONT><\/FONT><FONT color=#0000ff size=2><br \/>\n<P><FONT face=\"Courier New\">ALTER<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> <\/FONT><FONT color=#0000ff size=2>INDEX<\/FONT><FONT color=#000000 size=2> SmallTableCI <\/FONT><FONT color=#0000ff size=2>ON<\/FONT><FONT color=#000000 size=2> SmallTable <\/FONT><FONT color=#0000ff size=2>REBUILD<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#808080 size=2>;<BR><\/FONT><FONT size=2>GO<\/P><\/FONT><\/FONT><\/BLOCKQUOTE><br \/>\n<P>Now let&#8217;s look at the data page holding the two rows to see if there&#8217;s any versioning info (the output is snipped short a little for brevity):<\/P><br \/>\n<BLOCKQUOTE dir=ltr style=\"MARGIN-RIGHT: 0px\"><FONT color=#0000ff size=2><br \/>\n<P><FONT face=\"Courier New\">DBCC<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> IND <\/FONT><FONT color=#808080 size=2>(<\/FONT><FONT color=#000000 size=2>SItest<\/FONT><FONT color=#808080 size=2>,<\/FONT><FONT color=#000000 size=2> SmallTable<\/FONT><FONT color=#808080 size=2>,<\/FONT><FONT color=#000000 size=2> 1<\/FONT><FONT color=#808080 size=2>);<BR><\/FONT><\/FONT><FONT face=\"Courier New\" size=2>GO<\/P><\/FONT><FONT color=#0000ff size=2><br \/>\n<P><FONT face=\"Courier New\">DBCC<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> TRACEON <\/FONT><FONT color=#808080 size=2>(<\/FONT><FONT color=#000000 size=2>3604<\/FONT><FONT color=#808080 size=2>); <FONT color=#008000 size=2>&#8212; remember this makes the output go to the console<\/FONT><BR><\/FONT><\/FONT><FONT color=#0000ff size=2><FONT face=\"Courier New\">DBCC<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> PAGE <\/FONT><FONT color=#808080 size=2>(<\/FONT><FONT color=#000000 size=2>SItest<\/FONT><FONT color=#808080 size=2>,<\/FONT><FONT color=#000000 size=2> 1<\/FONT><FONT color=#808080 size=2>,<\/FONT><FONT color=#000000 size=2> 153<\/FONT><FONT color=#808080 size=2>,<\/FONT><FONT color=#000000 size=2> 3<\/FONT><FONT color=#808080 size=2>);<BR><\/FONT><\/FONT><FONT face=\"Courier New\" size=2>GO<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>PageFID PagePID&nbsp;&nbsp;&nbsp;&nbsp; IAMFID IAMPID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ObjectID&nbsp;&nbsp;&nbsp; IndexID<BR>&#8212;&#8212;- &#8212;&#8212;&#8212;&#8211; &#8212;&#8212; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211;<BR>1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 154&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2073058421&nbsp; 1<BR>1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 153&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 154&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2073058421&nbsp; 1<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>(2 row(s) affected)<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>DBCC execution completed. If DBCC printed error messages, contact your system administrator.<BR>DBCC execution completed. If DBCC printed error messages, contact your system administrator.<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>PAGE: (1:153)<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>&lt;SNIP SNIP SNIP&gt;<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>Slot 0 Offset 0x60 Length 15<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>Record Type = PRIMARY_RECORD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Record Attributes =&nbsp; NULL_BITMAP<BR>Memory Dump @0x6209C060<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>00000000:&nbsp;&nbsp; 10000c00 01000000 01000000 0300f9 &#8230;&#8230;&#8230;&#8230;&#8230;<BR>UNIQUIFIER = [NULL]<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>Slot 0 Column 1 Offset 0x4 Length 4<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>c1 = 1<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>Slot 0 Column 2 Offset 0x8 Length 4<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>c2 = 1<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>Slot 1 Offset 0x6f Length 15<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>Record Type = PRIMARY_RECORD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Record Attributes =&nbsp; NULL_BITMAP<BR>Memory Dump @0x6209C06F<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>00000000:&nbsp;&nbsp; 10000c00 02000000 02000000 0300f9 &#8230;&#8230;&#8230;&#8230;&#8230;<BR>UNIQUIFIER = [NULL]<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>Slot 1 Column 1 Offset 0x4 Length 4<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>c1 = 2<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>Slot 1 Column 2 Offset 0x8 Length 4<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>c2 = 2<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>DBCC execution completed. If DBCC printed error messages, contact your system administrator.<\/FONT><\/P><\/BLOCKQUOTE><br \/>\n<P dir=ltr>Nope &#8211; both the rows look normal. Now for completeness&nbsp;let&#8217;s try transaction level versioning and a rebuild:<\/P><FONT color=#0000ff size=2><br \/>\n<BLOCKQUOTE dir=ltr style=\"MARGIN-RIGHT: 0px\"><br \/>\n<P><FONT face=\"Courier New\">ALTER<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> <\/FONT><FONT color=#0000ff size=2>DATABASE<\/FONT><FONT color=#000000 size=2> SItest <\/FONT><FONT color=#0000ff size=2>SET<\/FONT><FONT color=#000000 size=2> <\/FONT><FONT color=#0000ff size=2>ALLOW_SNAPSHOT_ISOLATION<\/FONT><FONT color=#000000 size=2> <\/FONT><FONT color=#0000ff size=2>ON<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#808080 size=2>;<BR><\/FONT><FONT size=2>GO<\/FONT><\/FONT><\/P><FONT size=2><FONT color=#0000ff size=2><br \/>\n<P><FONT face=\"Courier New\">ALTER<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> <\/FONT><FONT color=#0000ff size=2>INDEX<\/FONT><FONT color=#000000 size=2> SmallTableCI <\/FONT><FONT color=#0000ff size=2>ON<\/FONT><FONT color=#000000 size=2> SmallTable <\/FONT><FONT color=#0000ff size=2>REBUILD<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#808080 size=2>;<BR><\/FONT><FONT size=2>GO<\/FONT><\/FONT><\/P><FONT size=2><FONT color=#0000ff size=2><br \/>\n<P><FONT face=\"Courier New\">DBCC<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> IND <\/FONT><FONT color=#808080 size=2>(<\/FONT><FONT color=#000000 size=2>SItest<\/FONT><FONT color=#808080 size=2>,<\/FONT><FONT color=#000000 size=2> SmallTable<\/FONT><FONT color=#808080 size=2>,<\/FONT><FONT color=#000000 size=2> 1<\/FONT><\/FONT><FONT face=\"Courier New\" color=#808080 size=2>);<BR><\/FONT><FONT size=2><FONT face=\"Courier New\">GO<\/FONT><\/P><FONT color=#0000ff size=2><br \/>\n<P><FONT face=\"Courier New\">DBCC<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> PAGE <\/FONT><FONT color=#808080 size=2>(<\/FONT><FONT color=#000000 size=2>SItest<\/FONT><FONT color=#808080 size=2>,<\/FONT><FONT color=#000000 size=2> 1<\/FONT><FONT color=#808080 size=2>,<\/FONT><FONT color=#000000 size=2> 143<\/FONT><FONT color=#808080 size=2>,<\/FONT><FONT color=#000000 size=2> 3<\/FONT><\/FONT><FONT color=#808080 size=2><FONT face=\"Courier New\">); <\/FONT><FONT face=\"Courier New\" color=#008000 size=2>&#8212; page changed when we rebuilt the index<BR><\/FONT><\/FONT><FONT face=\"Courier New\" size=2>GO<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>PageFID PagePID&nbsp;&nbsp;&nbsp;&nbsp; IAMFID IAMPID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ObjectID&nbsp;&nbsp;&nbsp; IndexID<BR>&#8212;&#8212;- &#8212;&#8212;&#8212;&#8211; &#8212;&#8212; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211;<BR>1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 152&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2073058421&nbsp; 1<BR>1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 143&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 152&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2073058421&nbsp; 1<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>(2 row(s) affected)<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>DBCC execution completed. If DBCC printed error messages, contact your system administrator.<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>PAGE: (1:143)<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>&lt;SNIP SNIP SNIP&gt;<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>Slot 0 Offset 0x60 Length 15<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>Record Type = PRIMARY_RECORD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Record Attributes =&nbsp; NULL_BITMAP<BR>Memory Dump @0x6209C060<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>00000000:&nbsp;&nbsp; 10000c00 01000000 01000000 0300f9 &#8230;&#8230;&#8230;&#8230;&#8230;<BR>UNIQUIFIER = [NULL]<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>Slot 0 Column 1 Offset 0x4 Length 4<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>c1 = 1<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>Slot 0 Column 2 Offset 0x8 Length 4<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>c2 = 1<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>Slot 1 Offset 0x6f Length 15<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>Record Type = PRIMARY_RECORD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Record Attributes =&nbsp; NULL_BITMAP<BR>Memory Dump @0x6209C06F<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>00000000:&nbsp;&nbsp; 10000c00 02000000 02000000 0300f9 &#8230;&#8230;&#8230;&#8230;&#8230;<BR>UNIQUIFIER = [NULL]<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>Slot 1 Column 1 Offset 0x4 Length 4<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>c1 = 2<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>Slot 1 Column 2 Offset 0x8 Length 4<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>c2 = 2<\/FONT><\/P><br \/>\n<P><FONT size=2><FONT face=\"Courier New\">DBCC execution completed. If DBCC printed error messages, contact your system administrator.<\/FONT><\/P><\/FONT><\/FONT><\/FONT><\/BLOCKQUOTE><\/FONT><br \/>\n<P>Nope &#8211; still nothing. Now I&#8217;ll force a versioning operation and we should see the tags. Any update to the table should cause versioned records to be created. In this case, I&#8217;ll start an explicit transaction and do some updates and we should be able to see the original values using another query window. First the updates:<\/P><FONT color=#0000ff size=2><br \/>\n<BLOCKQUOTE dir=ltr style=\"MARGIN-RIGHT: 0px\"><br \/>\n<P><FONT face=\"Courier New\">BEGIN<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> <\/FONT><FONT color=#0000ff size=2>TRAN<\/FONT><FONT color=#808080 size=2>;<BR><\/FONT><\/FONT><FONT face=\"Courier New\" size=2>GO<\/P><\/FONT><FONT color=#0000ff size=2><br \/>\n<P><FONT face=\"Courier New\">UPDATE<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> SmallTable <\/FONT><FONT color=#0000ff size=2>SET<\/FONT><FONT color=#000000 size=2> c1 <\/FONT><FONT color=#808080 size=2>=<\/FONT><FONT color=#000000 size=2> 4<\/FONT><FONT color=#808080 size=2>;<BR><\/FONT><\/FONT><FONT size=2><FONT face=\"Courier New\">GO<\/FONT><\/P><\/BLOCKQUOTE><br \/>\n<P>And in another window:<\/P><FONT color=#0000ff size=2><br \/>\n<BLOCKQUOTE dir=ltr style=\"MARGIN-RIGHT: 0px\"><br \/>\n<P><FONT face=\"Courier New\">SELECT<\/FONT><\/FONT><FONT face=\"Courier New\"><FONT color=#000000 size=2> <\/FONT><FONT color=#808080 size=2>*<\/FONT><FONT color=#000000 size=2> <\/FONT><FONT color=#0000ff size=2>FROM<\/FONT><FONT color=#000000 size=2> smalltable<\/FONT><FONT color=#808080 size=2>;<BR><\/FONT><\/FONT><FONT size=2><FONT face=\"Courier New\">GO<\/FONT><\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>c1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c2<BR>&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211;<BR>1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<BR>2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2<\/FONT><\/P><br \/>\n<P><FONT face=\"Courier New\" size=2>(2 row(s) affected)<\/FONT><\/P><\/BLOCKQUOTE><br \/>\n<P dir=ltr><FONT size=2>Cool &#8211; so the original values are still there. Let&#8217;s see the versioning info on the data page (output snipped again):<\/FONT><\/P><br \/>\n<BLOCKQUOTE dir=ltr style=\"MARGIN-RIGHT: 0px\"><br \/>\n<P dir=ltr><FONT face=\"Courier New\"><FONT color=#0000ff size=2>DBCC<\/FONT><FONT color=#000000 size=2> PAGE <\/FONT><FONT color=#808080 size=2>(<\/FONT><FONT color=#000000 size=2>SItest<\/FONT><FONT color=#808080 size=2>,<\/FONT><FONT color=#000000 size=2> 1<\/FONT><FONT color=#808080 size=2>,<\/FONT><FONT color=#000000 size=2> 143<\/FONT><FONT color=#808080 size=2>,<\/FONT><FONT color=#000000 size=2> 3<\/FONT><\/FONT><FONT face=\"Courier New\" color=#808080 size=2>);<BR><\/FONT><FONT size=2><FONT face=\"Courier New\">GO<\/FONT><\/P><br \/>\n<P dir=ltr><\/FONT><FONT face=\"Courier New\">PAGE: (1:143)<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">&lt;SNIP SNIP SNIP&gt;<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Slot 0 Offset 0x7e Length 29<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Record Type = GHOST_DATA_RECORD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Record Attributes =&nbsp; NULL_BITMAP <STRONG>VERSIONING_INFO<\/STRONG><\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Memory Dump @0x61CEC07E<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">00000000:&nbsp;&nbsp; 5c000c00 01000000 01000000 0300f9e0 \\&#8230;&#8230;&#8230;&#8230;&#8230;<BR>00000010:&nbsp;&nbsp; 00000001 00000057 03000000 00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8230;&#8230;.W&#8230;..<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\"><STRONG>Version Infomation = <BR>&nbsp;Transaction Timestamp: 855<BR>&nbsp;Version Pointer: (file 1 page 224 slot 0)<\/STRONG><\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">UNIQUIFIER = [NULL]<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Slot 0 Column 1 Offset 0x4 Length 4<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">c1 = 1<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Slot 0 Column 2 Offset 0x8 Length 4<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">c2 = 1<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Slot 1 Offset 0xb8 Length 29<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Record Type = GHOST_DATA_RECORD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Record Attributes =&nbsp; NULL_BITMAP <STRONG>VERSIONING_INFO<\/STRONG><\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Memory Dump @0x61CEC0B8<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">00000000:&nbsp;&nbsp; 5c000c00 02000000 02000000 0300f9e0 \\&#8230;&#8230;&#8230;&#8230;&#8230;<BR>00000010:&nbsp;&nbsp; 00000001 00010057 03000000 00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8230;&#8230;.W&#8230;..<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\"><STRONG>Version Infomation =<BR>&nbsp;Transaction Timestamp: 855<BR>&nbsp;Version Pointer: (file 1 page 224 slot 1)<\/STRONG><\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">UNIQUIFIER = [NULL]<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Slot 1 Column 1 Offset 0x4 Length 4<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">c1 = 2<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Slot 1 Column 2 Offset 0x8 Length 4<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">c2 = 2<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Slot 2 Offset 0x9b Length 29<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Record Type = PRIMARY_RECORD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Record Attributes =&nbsp; NULL_BITMAP <STRONG>VERSIONING_INFO<\/STRONG><\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Memory Dump @0x61CEC09B<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">00000000:&nbsp;&nbsp; 50000c00 04000000 01000000 0300f800 P&#8230;&#8230;&#8230;&#8230;&#8230;<BR>00000010:&nbsp;&nbsp; 00000000 00000057 03000000 00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8230;&#8230;.W&#8230;..<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\"><STRONG>Version Information =<BR>&nbsp;Transaction Timestamp: 855<BR>&nbsp;Version Pointer: Null<\/STRONG><\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">UNIQUIFIER = [NULL]<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Slot 2 Column 1 Offset 0x4 Length 4<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">c1 = 4<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Slot 2 Column 2 Offset 0x8 Length 4<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">c2 = 1<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Slot 3 Offset 0xd5 Length 37<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Record Type = PRIMARY_RECORD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Record Attributes =&nbsp; NULL_BITMAP VARIABLE_COLUMNS <STRONG>VERSIONING_INFO<\/STRONG><\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Memory Dump @0x61CEC0D5<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">00000000:&nbsp;&nbsp; 70000c00 04000000 02000000 0300f801 p&#8230;&#8230;&#8230;&#8230;&#8230;<BR>00000010:&nbsp;&nbsp; 00170001 00000000 00000000 00000057 &#8230;&#8230;&#8230;&#8230;&#8230;W<BR>00000020:&nbsp;&nbsp; 03000000 00&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;&#8230;..<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\"><STRONG>Version Information =<BR>&nbsp;Transaction Timestamp: 855<BR>&nbsp;Version Pointer: Null<\/STRONG><\/FONT><\/P><br \/>\n<P dir=ltr><BR><FONT face=\"Courier New\">Slot 3 Column 0 Offset 0x13 Length 4<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">UNIQUIFIER = 1<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Slot 3 Column 1 Offset 0x4 Length 4<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">c1 = 4<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">Slot 3 Column 2 Offset 0x8 Length 4<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">c2 = 2<\/FONT><\/P><br \/>\n<P dir=ltr><FONT face=\"Courier New\">DBCC execution completed. If DBCC printed error messages, contact your system administrator.<\/FONT><\/P><\/BLOCKQUOTE><br \/>\n<P dir=ltr><FONT size=2>I&#8217;ve marked the versioning parts in bold. Notice that the old records have been turned into ghost records too. The second record is now tagged as having variable-length columns too. This is because I updated both records to have the same clustering key value and so the second record now needs a uniquifier &#8211; which is stored as a variable-length column.<\/FONT><\/P><br \/>\n<P dir=ltr>So, the original statement&nbsp;is a myth &#8211; the only time that rows get versioning info added to them is when it&#8217;s needed to support a versioning operation.<FONT size=2><\/P><\/FONT><\/FONT><\/FONT><\/FONT><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ok &#8211; so we did more partying than we thought so blog posts have been a little sparse this month, but here&#8217;s one to end off the year. There&#8217;s a popular impression that turning on snapshot isolation and then rebuilding indexes will cause all rows in the table to get the extra 14-byte versioning tags. [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38,48,62,82],"tags":[],"class_list":["post-1112","post","type-post","status-publish","format-standard","hentry","category-example-scripts","category-inside-the-storage-engine","category-on-disk-structures","category-snapshot-isolation"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Inside the Storage Engine: When do versioning tags get added? - 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\/inside-the-storage-engine-when-do-versioning-tags-get-added\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Inside the Storage Engine: When do versioning tags get added? - Paul S. Randal\" \/>\n<meta property=\"og:description\" content=\"Ok &#8211; so we did more partying than we thought so blog posts have been a little sparse this month, but here&#8217;s one to end off the year. There&#8217;s a popular impression that turning on snapshot isolation and then rebuilding indexes will cause all rows in the table to get the extra 14-byte versioning tags. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/inside-the-storage-engine-when-do-versioning-tags-get-added\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2007-12-31T20:53:00+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=\"6 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\/inside-the-storage-engine-when-do-versioning-tags-get-added\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/inside-the-storage-engine-when-do-versioning-tags-get-added\/\",\"name\":\"Inside the Storage Engine: When do versioning tags get added? - Paul S. Randal\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2007-12-31T20:53:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/inside-the-storage-engine-when-do-versioning-tags-get-added\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/inside-the-storage-engine-when-do-versioning-tags-get-added\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/inside-the-storage-engine-when-do-versioning-tags-get-added\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Inside the Storage Engine: When do versioning tags get added?\"}]},{\"@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":"Inside the Storage Engine: When do versioning tags get added? - 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\/inside-the-storage-engine-when-do-versioning-tags-get-added\/","og_locale":"en_US","og_type":"article","og_title":"Inside the Storage Engine: When do versioning tags get added? - Paul S. Randal","og_description":"Ok &#8211; so we did more partying than we thought so blog posts have been a little sparse this month, but here&#8217;s one to end off the year. There&#8217;s a popular impression that turning on snapshot isolation and then rebuilding indexes will cause all rows in the table to get the extra 14-byte versioning tags. [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/inside-the-storage-engine-when-do-versioning-tags-get-added\/","og_site_name":"Paul S. Randal","article_published_time":"2007-12-31T20:53:00+00:00","author":"Paul Randal","twitter_misc":{"Written by":"Paul Randal","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/inside-the-storage-engine-when-do-versioning-tags-get-added\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/inside-the-storage-engine-when-do-versioning-tags-get-added\/","name":"Inside the Storage Engine: When do versioning tags get added? - Paul S. Randal","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2007-12-31T20:53:00+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/inside-the-storage-engine-when-do-versioning-tags-get-added\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/inside-the-storage-engine-when-do-versioning-tags-get-added\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/inside-the-storage-engine-when-do-versioning-tags-get-added\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"Inside the Storage Engine: When do versioning tags get added?"}]},{"@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\/1112","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=1112"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/1112\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=1112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=1112"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=1112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}