{"id":487,"date":"2012-05-11T02:08:00","date_gmt":"2012-05-11T02:08:00","guid":{"rendered":"\/blogs\/paul\/post\/Understanding-data-vs-log-usage-in-tempdb.aspx"},"modified":"2017-04-13T12:47:43","modified_gmt":"2017-04-13T19:47:43","slug":"understanding-data-vs-log-usage-for-spills-in-tempdb","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/understanding-data-vs-log-usage-for-spills-in-tempdb\/","title":{"rendered":"Understanding data vs log usage for spills in tempdb"},"content":{"rendered":"<p>\n<font face=\"verdana,geneva\" size=\"2\">Earlier this morning I noticed a discussion on the SQL MCM distribution list (that all the original MCM instructors are part of) that was trying to make sense of a huge disparity between tempdb data file usage and log file usage. I explained the answer and thought I&#39;d share it with you all too. <\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">The situation was a tempdb where the data files grew from 30GB to 120GB, running out of space on the disk, but the tempdb log file did not grow at all from its initial size of 1GB! How could that be? <\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">One of the things to consider about tempdb is that logging in tempdb is ultra-efficient. Log records for updates in tempdb, for instance, only log the before image of the data instead of logging both before and after images. There is no need to log the after image &#8211; as that is only used for the REDO portion of crash recovery. As tempdb never gets crash-recovered, REDO never occurs. The before image *is* necessary, however, because transactions can be rolled back in tempdb, just like other databases, and so the before image of an update must be available to be able to successfully roll back the update. <\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">Getting to the question though, I can easily explain the observed behavior by considering how a sort spill happens with tempdb. <\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">I can simulate this using a gnarly query on the <font face=\"courier new,courier\">SalesDB<\/font> database you can download from our <\/font><a href=\"https:\/\/www.sqlskills.com\/sql-server-resources\/sql-server-demos\/\" target=\"_blank\"><font face=\"verdana,geneva\" size=\"2\">resources page<\/font><\/a><font face=\"verdana,geneva\" size=\"2\"> (see the top of the page for the sample databases to download). <\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">I&#39;m going to do a join of my <font face=\"courier new,courier\">Sales<\/font> and <font face=\"courier new,courier\">Products<\/font> tables and then sort the multi-million row result set by product name: <\/font>\n<\/p>\n<blockquote>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">SELECT S.*, P.* from Sales S<br \/>\n\tJOIN Products P ON P.ProductID = S.ProductID<br \/>\n\tORDER BY P.Name;<br \/>\n\tGO&nbsp; <\/font>\n\t<\/p>\n<\/blockquote>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">The query plan for this is (using <\/font><a href=\"https:\/\/www.sentryone.com\/plan-explorer\" target=\"_blank\"><font face=\"verdana,geneva\" size=\"2\">Plan Explorer<\/font><\/a><font face=\"verdana,geneva\" size=\"2\">): <\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\"><img decoding=\"async\" src=\"\/blogs\/paul\/wp-content\/uploads\/2012\/5\/tempdbquery2.jpg\" alt=\"\" \/><\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">I know that the sort is going to spill out of memory into tempdb in this case. First I checkpoint tempdb (to clear out the log) and then after running the query, I can analyze the transaction log for tempdb.<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">Looking at the operation in the log:<\/font>\n<\/p>\n<blockquote>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">SELECT <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp; [Current LSN],<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp; [Operation],<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp; [Context],<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp; [Transaction ID],<br \/>\n\t&nbsp;&nbsp;&nbsp; &nbsp;[Log Record Length],<br \/>\n\t&nbsp;&nbsp;&nbsp; &nbsp;[Description]<br \/>\n\tFROM fn_dblog (null, null);<br \/>\n\tGO<\/p>\n<p>\tCurrent LSN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Operation&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context&nbsp; Transaction ID Len Description<br \/>\n\t&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8211; &#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n\t000000c0:00000077:0001 LOP_BEGIN_XACT&nbsp; LCX_NULL 0000:00005e4d&nbsp; 120 sort_init;&lt;snip&gt;<br \/>\n\t000000c0:00000077:0002 LOP_BEGIN_XACT&nbsp; LCX_NULL 0000:00005e4e&nbsp; 132 FirstPage Alloc;&lt;snip&gt;<br \/>\n\t000000c0:00000077:0003 LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_GAM&nbsp; 0000:00005e4e&nbsp; 60&nbsp; Allocated 1 extent(s) starting at page 0001:0000aa48<br \/>\n\t000000c0:00000077:0004 LOP_MODIFY_ROW&nbsp; LCX_PFS&nbsp; 0000:00005e4e&nbsp; 88&nbsp; Allocated 0001:0000aa48;Allocated 0001:0000aa49;<br \/>\n\t000000c0:00000077:0005 LOP_MODIFY_ROW&nbsp; LCX_PFS&nbsp; 0000:00005e4d&nbsp; 80&nbsp; Allocated 0001:00000123<br \/>\n\t000000c0:00000077:0006 LOP_FORMAT_PAGE LCX_IAM&nbsp; 0000:00005e4d&nbsp; 84&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>\n\t000000c0:00000077:0007 LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp; 0000:00005e4e&nbsp; 60&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>\n\t000000c0:00000077:0009 LOP_COMMIT_XACT LCX_NULL 0000:00005e4e&nbsp; 52&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>\n\t000000c0:00000077:000a LOP_BEGIN_XACT&nbsp; LCX_NULL 0000:00005e4f&nbsp; 128 soAllocExtents;&lt;snip&gt;<br \/>\n\t000000c0:00000077:000b LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_GAM&nbsp; 0000:00005e4f&nbsp; 60&nbsp; Allocated 1 extent(s) starting at page 0001:0000aa50<br \/>\n\t000000c0:00000077:000c LOP_MODIFY_ROW&nbsp; LCX_PFS&nbsp; 0000:00005e4f&nbsp; 88&nbsp; Allocated 0001:0000aa50;Allocated 0001:0000aa51;&lt;snip&gt;<br \/>\n\t000000c0:00000077:000d LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp; 0000:00005e4f&nbsp; 60&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>\n\t000000c0:00000077:000e LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_GAM&nbsp; 0000:00005e4f&nbsp; 60&nbsp; Allocated 1 extent(s) starting at page 0001:0000aa58<br \/>\n\t000000c0:00000077:000f LOP_MODIFY_ROW&nbsp; LCX_PFS&nbsp; 0000:00005e4f&nbsp; 88&nbsp; Allocated 0001:0000aa58;Allocated 0001:0000aa59;&lt;snip&gt;<br \/>\n\t000000c0:00000077:0010 LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp; 0000:00005e4f&nbsp; 60&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>\n\t000000c0:00000077:0011 LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_GAM&nbsp; 0000:00005e4f&nbsp; 60&nbsp; Allocated 1 extent(s) starting at page 0001:0000aa60<br \/>\n\t000000c0:00000077:0012 LOP_MODIFY_ROW&nbsp; LCX_PFS&nbsp; 0000:00005e4f&nbsp; 88&nbsp; Allocated 0001:0000aa60;Allocated 0001:0000aa61;&lt;snip&gt;<br \/>\n\t000000c0:00000077:0013 LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp; 0000:00005e4f&nbsp; 60&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>\n\t000000c0:00000077:0014 LOP_COMMIT_XACT LCX_NULL 0000:00005e4f&nbsp; 52&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>\n\t000000c0:00000077:0015 LOP_BEGIN_XACT&nbsp; LCX_NULL 0000:00005e50&nbsp; 128 soAllocExtents;&lt;snip&gt;<br \/>\n\t000000c0:00000077:0016 LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_GAM&nbsp; 0000:00005e50&nbsp; 60&nbsp; Allocated 1 extent(s) starting at page 0001:0000aa68<br \/>\n\t000000c0:00000077:0017 LOP_MODIFY_ROW&nbsp; LCX_PFS&nbsp; 0000:00005e50&nbsp; 88&nbsp; Allocated 0001:0000aa68;Allocated 0001:0000aa69;&lt;snip&gt;<br \/>\n\t000000c0:00000077:0018 LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp; 0000:00005e50&nbsp; 60&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>\n\t000000c0:00000077:0019 LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_GAM&nbsp; 0000:00005e50&nbsp; 60&nbsp; Allocated 1 extent(s) starting at page 0001:0000aa70<br \/>\n\t000000c0:00000077:001a LOP_MODIFY_ROW&nbsp; LCX_PFS&nbsp; 0000:00005e50&nbsp; 88&nbsp; Allocated 0001:0000aa70;Allocated 0001:0000aa71;&lt;snip&gt;<br \/>\n\t000000c0:00000077:001b LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp; 0000:00005e50&nbsp; 60&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>\n\t000000c0:00000077:001c LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_GAM&nbsp; 0000:00005e50&nbsp; 60&nbsp; Allocated 1 extent(s) starting at page 0001:0000aa78<br \/>\n\t000000c0:00000077:001d LOP_MODIFY_ROW&nbsp; LCX_PFS&nbsp; 0000:00005e50&nbsp; 88&nbsp; Allocated 0001:0000aa78;Allocated 0001:0000aa79;&lt;snip&gt;<br \/>\n\t000000c0:00000077:001e LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp; 0000:00005e50&nbsp; 60&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>\n\t000000c0:00000077:001f LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_GAM&nbsp; 0000:00005e50&nbsp; 60&nbsp; Allocated 1 extent(s) starting at page 0001:0000aa80<br \/>\n\t000000c0:00000077:0020 LOP_MODIFY_ROW&nbsp; LCX_PFS&nbsp; 0000:00005e50&nbsp; 88&nbsp; Allocated 0001:0000aa80;Allocated 0001:0000aa81;&lt;snip&gt;<br \/>\n\t000000c0:00000077:0021 LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp; 0000:00005e50&nbsp; 60&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>\n\t000000c0:00000077:0022 LOP_COMMIT_XACT LCX_NULL 0000:00005e50&nbsp; 52&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>\n\t000000c0:00000077:0023 LOP_BEGIN_XACT&nbsp; LCX_NULL 0000:00005e51&nbsp; 128 soAllocExtents;&lt;snip&gt;<\/font>\n\t<\/p>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">&lt;snip&gt;<\/font>\n\t<\/p>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">000000cd:00000088:01d3 LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_GAM&nbsp; 0000:000078fc&nbsp; 60&nbsp; Deallocated 1 extent(s) starting at page 0001:00010e50<br \/>\n\t000000cd:00000088:01d4 LOP_COMMIT_XACT LCX_NULL 0000:000078fc&nbsp; 52&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>\n\t000000cd:00000088:01d5 LOP_BEGIN_XACT&nbsp; LCX_NULL 0000:000078fd&nbsp; 140 ExtentDeallocForSort;&lt;snip&gt;<br \/>\n\t000000cd:00000088:01d6 LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_IAM&nbsp; 0000:000078fd&nbsp; 60&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>\n\t000000cd:00000088:01d7 LOP_MODIFY_ROW&nbsp; LCX_PFS&nbsp; 0000:000078fd&nbsp; 88&nbsp; Deallocated 0001:00010e68;Deallocated 0001:00010e69;&lt;snip&gt;<br \/>\n\t000000cd:00000088:01d8 LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_GAM&nbsp; 0000:000078fd&nbsp; 60&nbsp; Deallocated 1 extent(s) starting at page 0001:00010e68<br \/>\n\t000000cd:00000088:01d9 LOP_COMMIT_XACT LCX_NULL 0000:000078fd&nbsp; 52&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>\n\t000000cd:00000088:01da LOP_MODIFY_ROW&nbsp; LCX_PFS&nbsp; 0000:00005fac&nbsp; 80&nbsp; Deallocated 0001:00000109<br \/>\n\t000000cd:00000088:01db LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_SGAM 0000:00005fac&nbsp; 60&nbsp; ClearBit 0001:00000108<br \/>\n\t000000cd:00000088:01dc LOP_SET_BITS&nbsp;&nbsp;&nbsp; LCX_GAM&nbsp; 0000:00005fac&nbsp; 60&nbsp; Deallocated 1 extent(s) starting at page 0001:00000108<br \/>\n\t000000cd:00000088:01dd LOP_COMMIT_XACT LCX_NULL 0000:00005fac&nbsp; 52&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/font>\n\t<\/p>\n<\/blockquote>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">(I snipped out a few extraneous&nbsp;log records plus the 6 extra &#39;Allocated&#39; and&nbsp;&#39;Deallocated&#39; for each of the&nbsp;PFS row modifications.)&nbsp;<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">One of the things I notice is that the sort spill space is allocated in extents, and almost&nbsp;the entire sort &#8211; from initialization, through allocating all the extents, to deallocating them &#8211; is contained in a few very large transactions. But the transactions aren&#39;t actually that large.<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">Look at the <font face=\"courier new,courier\">soAllocExtents<\/font> transaction with <font face=\"courier new,courier\">Transaction ID<\/font> 00005e50. It&#39;s allocating 4 extents &#8211; i.e. 256KB &#8211; in a single system transction (4 x mark an extent as unavailable in the GAM,&nbsp;4 x bulk set the 8 PFS bytes for the 8 pages in the extent, 4 x mark&nbsp;an extent allocated in the IAM). The total size of the log records for this transaction is 1012 bytes. (The first <font face=\"courier new,courier\">soAllocExtents<\/font> system transaction only allocates 3 extents, all the others allocate 4 extents.)<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">When the sort ends, the extents are deallocated one-at-a-time in system transactions called <font face=\"courier new,courier\">ExtentDeallocForSort<\/font>. An example is the transaction with <font face=\"courier new,courier\">Transaction ID<\/font> 000078fd. It generates log records totalling 400 bytes. This means each 256KB takes 4 x 400 = 1600 bytes to deallocate.<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">Combining the allocation and deallocation operations, each 256KB of the sort that spills into tempdb generates 2612 bytes of log records.<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">Now let&#39;s consider the original behavior that I explained. If the 90GB was all sort space:<\/font>\n<\/p>\n<ul>\n<li>\n<div>\n\t<font face=\"verdana,geneva\" size=\"2\">90GB&nbsp;is 90 x 1024 x 1024 = 94371840KB, which is 94371840 \/ 256 = 368640 x 256KB chunks.<\/font>\n\t<\/div>\n<\/li>\n<li>\n<div>\n\t<font face=\"verdana,geneva\" size=\"2\">Each 256KB chunk takes 2612 bytes to allocate and deallocate, so our 90GB would take 368640 x 2612 = 962887680 bytes of log, which is 962887680 \/ 1024 \/ 1024 = ~918MB of log.<\/font>\n\t<\/div>\n<\/li>\n<\/ul>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">And this would explain the observed behavior. 90GB of tempdb space can be allocated and used for a sort spill with roughly 918MB of transaction log, give or take a bit from my rough calculations.<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">Tempdb logs things very efficiently &#8211; especially things that spill out of memory. The next stop in debugging such a problem would be regularly capturing the output of <font face=\"courier new,courier\">sys.dm_db_task_space_usage<\/font> to figure out who is using all the space and then digging in from there.<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">Hope this helps explain things!<\/font><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Earlier this morning I noticed a discussion on the SQL MCM distribution list (that all the original MCM instructors are part of) that was trying to make sense of a huge disparity between tempdb data file usage and log file usage. I explained the answer and thought I&#39;d share it with you all too. The [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66,93,98],"tags":[],"class_list":["post-487","post","type-post","status-publish","format-standard","hentry","category-performance-tuning","category-tempdb","category-transaction-log"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Understanding data vs log usage for spills in tempdb - 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\/understanding-data-vs-log-usage-for-spills-in-tempdb\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Understanding data vs log usage for spills in tempdb - Paul S. Randal\" \/>\n<meta property=\"og:description\" content=\"Earlier this morning I noticed a discussion on the SQL MCM distribution list (that all the original MCM instructors are part of) that was trying to make sense of a huge disparity between tempdb data file usage and log file usage. I explained the answer and thought I&#039;d share it with you all too. The [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/understanding-data-vs-log-usage-for-spills-in-tempdb\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2012-05-11T02:08:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-13T19:47:43+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=\"9 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\/understanding-data-vs-log-usage-for-spills-in-tempdb\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/understanding-data-vs-log-usage-for-spills-in-tempdb\/\",\"name\":\"Understanding data vs log usage for spills in tempdb - Paul S. Randal\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2012-05-11T02:08:00+00:00\",\"dateModified\":\"2017-04-13T19:47:43+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/understanding-data-vs-log-usage-for-spills-in-tempdb\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/understanding-data-vs-log-usage-for-spills-in-tempdb\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/understanding-data-vs-log-usage-for-spills-in-tempdb\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Understanding data vs log usage for spills in tempdb\"}]},{\"@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":"Understanding data vs log usage for spills in tempdb - 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\/understanding-data-vs-log-usage-for-spills-in-tempdb\/","og_locale":"en_US","og_type":"article","og_title":"Understanding data vs log usage for spills in tempdb - Paul S. Randal","og_description":"Earlier this morning I noticed a discussion on the SQL MCM distribution list (that all the original MCM instructors are part of) that was trying to make sense of a huge disparity between tempdb data file usage and log file usage. I explained the answer and thought I&#39;d share it with you all too. The [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/understanding-data-vs-log-usage-for-spills-in-tempdb\/","og_site_name":"Paul S. Randal","article_published_time":"2012-05-11T02:08:00+00:00","article_modified_time":"2017-04-13T19:47:43+00:00","author":"Paul Randal","twitter_misc":{"Written by":"Paul Randal","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/understanding-data-vs-log-usage-for-spills-in-tempdb\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/understanding-data-vs-log-usage-for-spills-in-tempdb\/","name":"Understanding data vs log usage for spills in tempdb - Paul S. Randal","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2012-05-11T02:08:00+00:00","dateModified":"2017-04-13T19:47:43+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/understanding-data-vs-log-usage-for-spills-in-tempdb\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/understanding-data-vs-log-usage-for-spills-in-tempdb\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/understanding-data-vs-log-usage-for-spills-in-tempdb\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"Understanding data vs log usage for spills in tempdb"}]},{"@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\/487","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=487"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/487\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}