<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Update Statistics Before or After an Index Rebuild?</title>
	<atom:link href="http://benchmarkitconsulting.com/colin-stasiuk/2009/02/11/update-statistics-before-or-after-an-index-rebuild/feed/" rel="self" type="application/rss+xml" />
	<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/02/11/update-statistics-before-or-after-an-index-rebuild/</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2012 14:49:48 -0700</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Colin</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/02/11/update-statistics-before-or-after-an-index-rebuild/comment-page-1/#comment-5176</link>
		<dc:creator>Colin</dc:creator>
		<pubDate>Fri, 18 Feb 2011 15:21:31 +0000</pubDate>
		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=447#comment-5176</guid>
		<description>Hi Scott

Thanks for the comment :) it&#039;s always nice to hear that a blog post (even a 2 year old one) has helped someone along the way.

Personally I always leave auto create and update stats on unless there was a specific reason to turn it off.  I&#039;ve found that the &quot;auto update stats&quot; doesn&#039;t catch everything I want which is why I do things manually as well but it DOES do some of what should be done and for that reason I leave it on.

Thanks again for reading! :)</description>
		<content:encoded><![CDATA[<p>Hi Scott</p>
<p>Thanks for the comment <img src='http://benchmarkitconsulting.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  it&#8217;s always nice to hear that a blog post (even a 2 year old one) has helped someone along the way.</p>
<p>Personally I always leave auto create and update stats on unless there was a specific reason to turn it off.  I&#8217;ve found that the &#8220;auto update stats&#8221; doesn&#8217;t catch everything I want which is why I do things manually as well but it DOES do some of what should be done and for that reason I leave it on.</p>
<p>Thanks again for reading! <img src='http://benchmarkitconsulting.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott W</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/02/11/update-statistics-before-or-after-an-index-rebuild/comment-page-1/#comment-5175</link>
		<dc:creator>Scott W</dc:creator>
		<pubDate>Fri, 18 Feb 2011 00:08:26 +0000</pubDate>
		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=447#comment-5175</guid>
		<description>Thanks for the article, Colin! I know it&#039;s two-years old, but still good information.

I used to rebuild all indexes, then update stats (with fullscan).  It was very time consuming, and somewhat redundant since the index rebuild updated index statistics anyway.  Then one day I actually read up on the UPDATE STATISTICS command and found that I could use it to only update column statistics. Ah, the power of reading.

So now my weekly plan of attack is to rebuild indexes that are more than 20% fragmented and have more than 1000 pages, followed up immediately by updating column statistics only:

sp_MSForEachTable &quot;UPDATE STATISTICS ? with fullscan, columns&quot;

As Amar mentioned in the comments above, I still have auto update stats on.  If I&#039;m doing the index rebuild/update stats on a weekly basis, should I turn off auto update stats?</description>
		<content:encoded><![CDATA[<p>Thanks for the article, Colin! I know it&#8217;s two-years old, but still good information.</p>
<p>I used to rebuild all indexes, then update stats (with fullscan).  It was very time consuming, and somewhat redundant since the index rebuild updated index statistics anyway.  Then one day I actually read up on the UPDATE STATISTICS command and found that I could use it to only update column statistics. Ah, the power of reading.</p>
<p>So now my weekly plan of attack is to rebuild indexes that are more than 20% fragmented and have more than 1000 pages, followed up immediately by updating column statistics only:</p>
<p>sp_MSForEachTable &#8220;UPDATE STATISTICS ? with fullscan, columns&#8221;</p>
<p>As Amar mentioned in the comments above, I still have auto update stats on.  If I&#8217;m doing the index rebuild/update stats on a weekly basis, should I turn off auto update stats?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Feroz R</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/02/11/update-statistics-before-or-after-an-index-rebuild/comment-page-1/#comment-5164</link>
		<dc:creator>Feroz R</dc:creator>
		<pubDate>Mon, 24 Jan 2011 17:02:35 +0000</pubDate>
		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=447#comment-5164</guid>
		<description>I simply love this practical way of understand stuff. Thanks a lot for posting this info.</description>
		<content:encoded><![CDATA[<p>I simply love this practical way of understand stuff. Thanks a lot for posting this info.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Colin Stasiuk</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/02/11/update-statistics-before-or-after-an-index-rebuild/comment-page-1/#comment-4805</link>
		<dc:creator>Colin Stasiuk</dc:creator>
		<pubDate>Tue, 20 Apr 2010 16:29:44 +0000</pubDate>
		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=447#comment-4805</guid>
		<description>Jay

I ran the following:

 Delete from dbo.tblIndexStatsMaintenance where [ID] &gt; 2000

then ran:

 DBCC SHOW_STATISTICS (&#039;tblIndexStatsMaintenance&#039;, stats_NonIndexedData) WITH STAT_HEADER

which showed no change... (as expected) then ran:

 EXEC sp_updatestats

and when I reran the SHOW_STATISTICS I saw the statistic was updated as expected.

I re-read your comment... and I missed rebuilding the index after the deletion of the records... I re-ran to match your use case exactly and low and behold I saw the same thing you saw.

Very weird and I can&#039;t explain right now as to why this is. I re-ran the usecase both ways a few times and got the same results each time.

Hopefully someone else on the thread will be able to shed some light on this one.  I&#039;ll also throw it back out there to Twitter to see if we can get some thoughts on why this would happen.

Thanks for the comment!!</description>
		<content:encoded><![CDATA[<p>Jay</p>
<p>I ran the following:</p>
<p> Delete from dbo.tblIndexStatsMaintenance where [ID] > 2000</p>
<p>then ran:</p>
<p> DBCC SHOW_STATISTICS (&#8216;tblIndexStatsMaintenance&#8217;, stats_NonIndexedData) WITH STAT_HEADER</p>
<p>which showed no change&#8230; (as expected) then ran:</p>
<p> EXEC sp_updatestats</p>
<p>and when I reran the SHOW_STATISTICS I saw the statistic was updated as expected.</p>
<p>I re-read your comment&#8230; and I missed rebuilding the index after the deletion of the records&#8230; I re-ran to match your use case exactly and low and behold I saw the same thing you saw.</p>
<p>Very weird and I can&#8217;t explain right now as to why this is. I re-ran the usecase both ways a few times and got the same results each time.</p>
<p>Hopefully someone else on the thread will be able to shed some light on this one.  I&#8217;ll also throw it back out there to Twitter to see if we can get some thoughts on why this would happen.</p>
<p>Thanks for the comment!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jp</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/02/11/update-statistics-before-or-after-an-index-rebuild/comment-page-1/#comment-4798</link>
		<dc:creator>jp</dc:creator>
		<pubDate>Mon, 19 Apr 2010 16:48:45 +0000</pubDate>
		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=447#comment-4798</guid>
		<description>http://sqlug.be/blogs/wesleyb/archive/2007/11/13/update-statistics-before-or-after-my-index-rebuild.aspx</description>
		<content:encoded><![CDATA[<p><a href="http://sqlug.be/blogs/wesleyb/archive/2007/11/13/update-statistics-before-or-after-my-index-rebuild.aspx" rel="nofollow">http://sqlug.be/blogs/wesleyb/archive/2007/11/13/update-statistics-before-or-after-my-index-rebuild.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/02/11/update-statistics-before-or-after-an-index-rebuild/comment-page-1/#comment-4792</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Sun, 18 Apr 2010 14:08:51 +0000</pubDate>
		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=447#comment-4792</guid>
		<description>I did some testing on this, and sp_updatestats doesn&#039;t appear to work the exact way I imagined. 
I deleted all the records where id &gt; 2000 then rebuilt the index. I then ran sp_updatestats thinking that the stats for stats_NonIndexedData would have been updated, but i got the message below.
[stats_NonIndexedData], update is not necessary...

This is an example where obviously the stats should have been updated, but weren&#039;t.</description>
		<content:encoded><![CDATA[<p>I did some testing on this, and sp_updatestats doesn&#8217;t appear to work the exact way I imagined.<br />
I deleted all the records where id &gt; 2000 then rebuilt the index. I then ran sp_updatestats thinking that the stats for stats_NonIndexedData would have been updated, but i got the message below.<br />
[stats_NonIndexedData], update is not necessary&#8230;</p>
<p>This is an example where obviously the stats should have been updated, but weren&#8217;t.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BradC</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/02/11/update-statistics-before-or-after-an-index-rebuild/comment-page-1/#comment-4502</link>
		<dc:creator>BradC</dc:creator>
		<pubDate>Thu, 19 Nov 2009 22:51:18 +0000</pubDate>
		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=447#comment-4502</guid>
		<description>So for a SQL 2000 server, does this advice still apply? 
Since sp_updatestats appears to have really updated *all* stats in SQL 2000, I wouldn&#039;t want to overwrite the &quot;good&quot; stats with bad ones.

So should I do the sp_updatestats *before* the reindex on sql2000?</description>
		<content:encoded><![CDATA[<p>So for a SQL 2000 server, does this advice still apply?<br />
Since sp_updatestats appears to have really updated *all* stats in SQL 2000, I wouldn&#8217;t want to overwrite the &#8220;good&#8221; stats with bad ones.</p>
<p>So should I do the sp_updatestats *before* the reindex on sql2000?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Colin Stasiuk</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/02/11/update-statistics-before-or-after-an-index-rebuild/comment-page-1/#comment-4312</link>
		<dc:creator>Colin Stasiuk</dc:creator>
		<pubDate>Tue, 06 Oct 2009 20:40:12 +0000</pubDate>
		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=447#comment-4312</guid>
		<description>Ross - rebuilding (not reorganizing) your indexes will update ONLY the statistics for those indexes... but if you have other statistics then those stats will NOT get updated as part of your index rebuild.  

Also as Grant mentioned you&#039;ll want to be cautious on how you update your statistics AFTER an index rebuild has taken place... cause if your sample size is smaller then a full scan then you might actually &quot;get good statistics turned bad&quot;

Hopefully this helps and I&#039;ve re-ran my code/test shown above again just to be sure but that &quot;demo&quot; should give you a hands-on solution to play with.

Thanks!!</description>
		<content:encoded><![CDATA[<p>Ross &#8211; rebuilding (not reorganizing) your indexes will update ONLY the statistics for those indexes&#8230; but if you have other statistics then those stats will NOT get updated as part of your index rebuild.  </p>
<p>Also as Grant mentioned you&#8217;ll want to be cautious on how you update your statistics AFTER an index rebuild has taken place&#8230; cause if your sample size is smaller then a full scan then you might actually &#8220;get good statistics turned bad&#8221;</p>
<p>Hopefully this helps and I&#8217;ve re-ran my code/test shown above again just to be sure but that &#8220;demo&#8221; should give you a hands-on solution to play with.</p>
<p>Thanks!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ross Mistry</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/02/11/update-statistics-before-or-after-an-index-rebuild/comment-page-1/#comment-4311</link>
		<dc:creator>Ross Mistry</dc:creator>
		<pubDate>Tue, 06 Oct 2009 20:19:34 +0000</pubDate>
		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=447#comment-4311</guid>
		<description>I was told that there isn&#039;t a need to update statistics if you just rebuilt all of your indexes as the statistics are automatically updated.  Is this True or False?

Ross</description>
		<content:encoded><![CDATA[<p>I was told that there isn&#8217;t a need to update statistics if you just rebuilt all of your indexes as the statistics are automatically updated.  Is this True or False?</p>
<p>Ross</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Grant Fritchey</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/02/11/update-statistics-before-or-after-an-index-rebuild/comment-page-1/#comment-4074</link>
		<dc:creator>Grant Fritchey</dc:creator>
		<pubDate>Wed, 24 Jun 2009 11:50:10 +0000</pubDate>
		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=447#comment-4074</guid>
		<description>One point not addressed that might be of concern, if you&#039;ve done a full rebuild of the index, and it uses a full scan to update the statistics, what happens if you run sp_updatestats and it decides to update the statistics based on the normal, sampled, approach? You can get good statistics turned bad. From a safety standpoint, if you&#039;ve just rebuilt an index, best not to also update it&#039;s statistics.</description>
		<content:encoded><![CDATA[<p>One point not addressed that might be of concern, if you&#8217;ve done a full rebuild of the index, and it uses a full scan to update the statistics, what happens if you run sp_updatestats and it decides to update the statistics based on the normal, sampled, approach? You can get good statistics turned bad. From a safety standpoint, if you&#8217;ve just rebuilt an index, best not to also update it&#8217;s statistics.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

