Updating statistics sql 2016 r2

Product(Products) WITH SAMPLE 50 PERCENT [/cc] Using update statistics can give you the granularity of control to only update the out of date statistics, thus having less impact on your production system.

I can assure you that each of the databases in the listing above had AUTO_UPDATE_STATISTICS and AUTO_CREATE_STATISTICS both set to ON, yet the following results are indicative of statistics that can become outdated.

What we need is a quick solution for updating all the statistics for every database on our SQL Server instance. Because of this you simply can not rely on the engine to keep you statistics in check and current.

Before you go ahead and state the fact that you have AUTO_UPDATE_STATISTICS ON for your databases remember that does not mean that they are being updated! Here is a simple block of code that will iterate through all your databases in order to build the sp_updatestats command that can then be copied and pasted into a new query window for execution.

If you're like me, you have a SQL Agent job in place to rebuild or reorganize only the indexes in your databases that truly require such actions.

If you rely on the standard maintenance plans in Microsoft SQL Server, a policy of rebuilding all indexes occurs.

Leave a Reply