Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Update Stats after index creation in SQL SERVER 08

Author  Topic 

anonymous2009
Starting Member

8 Posts

Posted - 2012-05-01 : 17:45:01
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

15732 Posts

Posted - 2012-05-01 : 17:49:23
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 - 2012-05-01 : 18:14:03
ok got it.
Thanks!
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2012-05-02 : 01:38:20
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
   

- Advertisement -