update statistics

hi,

Im upgrading fro SQL 2008 R2 to SQL 2012, i ve quite  a few huge databases, i will be running dbcc checkdb and update statistics statements after upgrade is done. If i run update stats command with fullscan, i know its going to take long time, is there any script or any option in update stats to run update stats faster?

August 27th, 2015 6:06pm

What are you trying to achieve by updating stats. with out reorganizing indexes.

As this is your migration from SQL 2008 to 2012 take time and schedule maintenance and rebuild indexes.

Yes it will take time if your databases are big but it is worth doing.


Free Windows Admin Tool Kit Click here and download it now
August 27th, 2015 6:11pm

1) change database compatibility to 110.

2) rebuild and reorganize index depend on index fragmentation.

3)update statics.

DECLARE @SQL VARCHAR(1000)  
DECLARE @DB sysname  

DECLARE curDB CURSOR FORWARD_ONLY STATIC FOR  
   SELECT 
[name]  
   FROM master..sysdatabases 
   WHERE [name] NOT IN ('model''tempdb'
   
ORDER BY [name] 
     
OPEN curDB  
FETCH NEXT FROM curDB INTO @DB  
WHILE @@FETCH_STATUS 0  
   BEGIN  
       SELECT 
@SQL 'USE [' @DB +']' CHAR(13) + 'EXEC sp_updatestats' CHAR(13)  
       
PRINT @SQL  
       
FETCH NEXT FROM curDB INTO @DB  
   
END  
    
CLOSE 
curDB  
DEALLOCATE 
curDB

you can change database name in script.

August 27th, 2015 9:47pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics