Sql-server – What’s the impact of running sp_updatestats in production server

index-statisticssql serversql-server-2008-r2statistics

Is it safe to run sp_updatestats on an SQL Server in the production environment?

Or rather, what is the impact of updating all statistics on a sql server? Can it "choke" the sql server while it runs and cause timeouts or other issues for the users?

Best Answer

That's a big 'it depends.' Depending on how your statistics have been maintained and the options you specify you could end up running full table/index scans and thrashing your I/O and buffer pool. Depending on the characteristics of your hardware and databases that could be very bad.

Also, rebuilding statistics invalidates execution plans, which means you could see a CPU spike and slower performance while SQL Server re-compiles queries.

Best practices dictate updating statistics during off-peak hours to minimize impact. Otherwise, take due precautions to minimize load on the system such as rebuilding statistics on only the tables that require it over a period of time.

Check books online for more information:

http://technet.microsoft.com/en-us/library/ms173804(v=sql.110).aspx

http://technet.microsoft.com/en-us/library/ms187348.aspx