May 1, 2012 at 3:44 pm
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!
May 1, 2012 at 11:01 pm
It will create the stat automatically after creating an index.
If no parameter after sp_updatestats, it will update ALL the stats within that database.
May 2, 2012 at 7:25 am
anonymous2009 (5/1/2012)
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?
The latter...stats are created when the index is built. Running sp_updatestats after creating an index should not affect the stats on the new index. As long as nothing has updated the table data underlying the index, sp_updatestats should skip trying to update the stats for it.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
May 2, 2012 at 7:28 am
Wildcat (5/1/2012)
If no parameter after sp_updatestats, it will update ALL the stats within that database.
sp_updatestats will evaluate each stat, but only update those that it deems necessary based on how much the underlying rows have changed since the stat was built.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply