{"id":1137,"date":"2007-11-05T03:01:40","date_gmt":"2007-11-05T03:01:40","guid":{"rendered":"\/blogs\/paul\/post\/Conference-Questions-Pot-Pourri-1-Indexes-stats-corruption-and-Enterprise-only-features.aspx"},"modified":"2017-07-17T08:45:14","modified_gmt":"2017-07-17T15:45:14","slug":"conference-questions-pot-pourri-1-indexes-stats-corruption-and-enterprise-only-features","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/conference-questions-pot-pourri-1-indexes-stats-corruption-and-enterprise-only-features\/","title":{"rendered":"Conference Questions Pot-Pourri #1: Indexes, stats, corruption, and Enterprise-only features"},"content":{"rendered":"<p align=\"justify\">As promised, here&#8217;s the first of the grab-bag of questions we were asked during conferences. I&#8217;m blogging a selection of the stuff I noted down.\u00a0These are some of the questions we were asked during our pre-con at SQL Connections on <em>Database Maintenance: From Planning to Practice to Post-Mortem<\/em>. It was cool that people came prepared with so many great questions &#8211; most of which we answered during the session and some I need to follow-up with the Product Team about.<\/p>\n<p align=\"justify\"><strong>Q1) I have a filegroup with two files. I add a third file, use some of the space, and then do a rebuild of the index that takes up most of the space in the original two files. Why doesn&#8217;t the newly rebuilt index get spread evenly across the three files? I.e. why doesn&#8217;t SQL Server re-balance the data across the files?<\/strong><\/p>\n<p align=\"justify\"><strong>A1)<\/strong> There are two things to consider here. The first is the way that SQL Server allocates space from multiple files in a filegroup. It uses a mechanism called <em>proportional-fill<\/em> that will allocates space from files in round-robin fashion, but weights the allocations towards files that are larger and have more free space. In the example above, the space in the newly-added third file will be used before the first and second files are grown to add more space. The second thing to consider is that the process of rebuilding an index requires building a <span style=\"text-decoration: underline;\">new<\/span> copy of the index before dropping the old on &#8211; so in the example above, the existing allocated space can&#8217;t be reused until after the index rebuild operation completes.<\/p>\n<p align=\"justify\">The concept of adding a file and having SQL Server re-balance the data across the files doesn&#8217;t exist. It was something I proposed during SQL Server 2005 development but we (seriously) didn&#8217;t have time to do it. The solution I recommend is to create a new filegroup with as many files as you need, rebuild the index into the new filegroup using the <em>CREATE INDEX WITH DROP_EXISTING<\/em> command, and then drop the old filegroup.<\/p>\n<p align=\"justify\"><strong>Q2) Multiple questions about whether a non-clustered index gets rebuilt on SQL Server 2005 under different circumstances<\/strong><\/p>\n<p align=\"justify\"><strong>A2) <\/strong>See the blog post I wrote <a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/indexes-from-every-angle-what-happens-to-non-clustered-indexes-when-the-table-structure-is-changed\/\">here<\/a> which goes into all the different combinations. A lot of the confusion comes from the fact that on SQL Server 2000, for non-unique clustered indexes where SQL Server has to generate a uniquifying value (called a <em>uniquifier<\/em>), when it gets rebuilt all the non-clustered indexes have to be rebuilt too as the uniquifier values are regenerated. On SQL Server 2005 this is not the case &#8211; a BIG improvement.<\/p>\n<p align=\"justify\"><strong>Q3)<\/strong> <strong>A lot of the features we discussed (e.g. partitioning and online operations) are in Enterprise Edition only. What&#8217;s the complete list of features that are in Enterprise vs Standard Editions for SQL Server 2005?<\/strong><\/p>\n<p align=\"justify\"><strong>A3)<\/strong> The best list we know of is in MSDN &#8211; <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/ms143761.aspx\">http:\/\/msdn2.microsoft.com\/en-us\/library\/ms143761.aspx<\/a><\/p>\n<p align=\"justify\"><strong>Q4) In a maintenance plan, is it a good idea to do an index rebuild followed by an update statistics?<\/strong><\/p>\n<p align=\"justify\"><strong>A4)<\/strong> No! An index rebuild will do the equivalent of an update stats with a full scan. A manual update stats will use whichever sampling rate was set for that particular set of statistics. So &#8211; not only does doing an update stats after an index rebuild waste resources, you may actually end of with a worse set of stats if the manualy update stats only does a sampled scan.<\/p>\n<p align=\"justify\"><strong>Q5) How can you tell whether <em>DBCC CHECKDB<\/em> is doing a <em>deep-dive<\/em> that&#8217;s going to take much longer than usual?<\/strong><\/p>\n<p align=\"justify\"><strong>A5)<\/strong> There are several algorithms in <em>DBCC CHECKDB<\/em> that are designed to quickly tell whether a corruption exists or not, but at the expense of not being able to tell exactly <em>where<\/em> the corruption is. The justification for this is that corruptions are not very common (considering the millions of times per day that <em>DBCC CHECKDB<\/em> is run) and so it makes sense to engineer for the success case and take the hit of a longer run-time in the error case. When a corruption is discovered there hasn&#8217;t been any to tell that <em>DBCC CHECKDB<\/em> is going to run longer than usual until SQL Server 2005 SP2. In SP2 a new error, 5268 was added that will be output to the error log when one of the deep-dive algorithms is triggered. I advise you to add an alert on this error.<\/p>\n<p align=\"justify\"><strong>Q6) What are the various forums where Paul answers questions on corruptions?<\/strong><\/p>\n<p align=\"justify\"><strong>A6)<\/strong> There are 4 forums that I (and others with good advice also) frequent:<\/p>\n<ul>\n<li>The SQL Team <a href=\"http:\/\/www.sqlteam.com\/forums\/forum.asp?FORUM_ID=22\">Data Corruption Forum<\/a><\/li>\n<li>The MSDN <a href=\"https:\/\/social.msdn.microsoft.com:443\/forums\/en-US\/sqldisasterrecovery\/threads\/\">Disaster Recovery and Availability Forum<\/a>\u00a0that I founded while I was at Microsoft<\/li>\n<li>The SQL Server Central <a href=\"http:\/\/www.sqlservercentral.com\/Forums\/Forum266-1.aspx\">2005 Data Corruption Forum<\/a><\/li>\n<li>The SQL Server Central <a href=\"http:\/\/www.sqlservercentral.com\/Forums\/Forum265-1.aspx\">2000\/7.0 Data Corruption Forum<\/a><\/li>\n<\/ul>\n<p align=\"justify\">I&#8217;m also happy for you to send me email! Just beware that on forum posts and emails you may not get a reply from anyone for a day or more &#8211; so if you have a critical server-down issue then you should contact SQL Product Support.<\/p>\n<p align=\"justify\">Ok &#8211; that&#8217;s enough for tonight. More tomorrow from the Disaster Recovery workshop. Thanks to everyone who came to the workshop today!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As promised, here&#8217;s the first of the grab-bag of questions we were asked during conferences. I&#8217;m blogging a selection of the stuff I noted down.\u00a0These are some of the questions we were asked during our pre-con at SQL Connections on Database Maintenance: From Planning to Practice to Post-Mortem. It was cool that people came prepared [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,27,30,31],"tags":[],"class_list":["post-1137","post","type-post","status-publish","format-standard","hentry","category-conference-questions-pot-pourri","category-conferences","category-corruption","category-database-maintenance"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Conference Questions Pot-Pourri #1: Indexes, stats, corruption, and Enterprise-only features - 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\/conference-questions-pot-pourri-1-indexes-stats-corruption-and-enterprise-only-features\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Conference Questions Pot-Pourri #1: Indexes, stats, corruption, and Enterprise-only features - Paul S. Randal\" \/>\n<meta property=\"og:description\" content=\"As promised, here&#8217;s the first of the grab-bag of questions we were asked during conferences. I&#8217;m blogging a selection of the stuff I noted down.\u00a0These are some of the questions we were asked during our pre-con at SQL Connections on Database Maintenance: From Planning to Practice to Post-Mortem. It was cool that people came prepared [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/conference-questions-pot-pourri-1-indexes-stats-corruption-and-enterprise-only-features\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2007-11-05T03:01:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-07-17T15:45:14+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=\"4 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\/conference-questions-pot-pourri-1-indexes-stats-corruption-and-enterprise-only-features\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/conference-questions-pot-pourri-1-indexes-stats-corruption-and-enterprise-only-features\/\",\"name\":\"Conference Questions Pot-Pourri #1: Indexes, stats, corruption, and Enterprise-only features - Paul S. Randal\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2007-11-05T03:01:40+00:00\",\"dateModified\":\"2017-07-17T15:45:14+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/conference-questions-pot-pourri-1-indexes-stats-corruption-and-enterprise-only-features\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/conference-questions-pot-pourri-1-indexes-stats-corruption-and-enterprise-only-features\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/conference-questions-pot-pourri-1-indexes-stats-corruption-and-enterprise-only-features\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Conference Questions Pot-Pourri #1: Indexes, stats, corruption, and Enterprise-only features\"}]},{\"@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":"Conference Questions Pot-Pourri #1: Indexes, stats, corruption, and Enterprise-only features - 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\/conference-questions-pot-pourri-1-indexes-stats-corruption-and-enterprise-only-features\/","og_locale":"en_US","og_type":"article","og_title":"Conference Questions Pot-Pourri #1: Indexes, stats, corruption, and Enterprise-only features - Paul S. Randal","og_description":"As promised, here&#8217;s the first of the grab-bag of questions we were asked during conferences. I&#8217;m blogging a selection of the stuff I noted down.\u00a0These are some of the questions we were asked during our pre-con at SQL Connections on Database Maintenance: From Planning to Practice to Post-Mortem. It was cool that people came prepared [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/conference-questions-pot-pourri-1-indexes-stats-corruption-and-enterprise-only-features\/","og_site_name":"Paul S. Randal","article_published_time":"2007-11-05T03:01:40+00:00","article_modified_time":"2017-07-17T15:45:14+00:00","author":"Paul Randal","twitter_misc":{"Written by":"Paul Randal","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/conference-questions-pot-pourri-1-indexes-stats-corruption-and-enterprise-only-features\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/conference-questions-pot-pourri-1-indexes-stats-corruption-and-enterprise-only-features\/","name":"Conference Questions Pot-Pourri #1: Indexes, stats, corruption, and Enterprise-only features - Paul S. Randal","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2007-11-05T03:01:40+00:00","dateModified":"2017-07-17T15:45:14+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/conference-questions-pot-pourri-1-indexes-stats-corruption-and-enterprise-only-features\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/conference-questions-pot-pourri-1-indexes-stats-corruption-and-enterprise-only-features\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/conference-questions-pot-pourri-1-indexes-stats-corruption-and-enterprise-only-features\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"Conference Questions Pot-Pourri #1: Indexes, stats, corruption, and Enterprise-only features"}]},{"@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\/1137","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=1137"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/1137\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=1137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=1137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=1137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}