SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Update Stats after index creation in SQL SERVER 08
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

anonymous2009
Starting Member

8 Posts

Posted - 05/01/2012 :  17:45:01  Show Profile  Reply with Quote
Hello,
When a new index is added to an existing table with rows in it, is it always required to execute the following to update the stats (or) will Create Index will inturn also updatethe stats?

USE DBName;
GO
EXEC sp_updatestats

Would this gather stats for all the tables in database DBName?
Thanks!

robvolk
Most Valuable Yak

USA
15557 Posts

Posted - 05/01/2012 :  17:49:23  Show Profile  Visit robvolk's Homepage  Reply with Quote
It's not required, they do different things. CREATE INDEX will create the statistics for just that index. sp_updatestats works on all tables.
Go to Top of Page

anonymous2009
Starting Member

8 Posts

Posted - 05/01/2012 :  18:14:03  Show Profile  Reply with Quote
ok got it.
Thanks!
Go to Top of Page

jackv
Flowing Fount of Yak Knowledge

United Kingdom
1765 Posts

Posted - 05/02/2012 :  01:38:20  Show Profile  Visit jackv's Homepage  Reply with Quote
By default CREATE INDEX will do a statistics refresh - this can't be turned off.

There is another parameter in CREATE INDEX : STATISTICS_NORECOMPUTE. This defines whether the "auto_update_stats" is on or off for this index

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000