How to Find and Update Outdated Statistics in SQL Server

We can find when the last update statistics happened and how many row modifications happened since the last update statistics using sys.dm_db_stats_properties DMV and a few joins.  We can refine this by Data Last updated and total rows and modified rows as needed.
Using the result of the above query you can identify if the update statistics are happening at regular intervals or if you need to schedule the update statistics from time to time.

Using the below will update all the statistics as needed from the above. ** Please note that we have refined this as depending upon the table size and volume this can cause a lot of IO and you should run this during a time that is best for you business and application needs ** 

Using the result of the above query you can identify if the update statistics are happening at regular intervals or if you need to schedule the update statistics from time to time.

Comments

Popular posts from this blog

How to mass update all or some sql server agent job step commands

SQL Monitoring for Blocking and Locking Capture and Log to table with sp_WhoIsActive or sp_BlitzWho

SQL Server General Index Naming Convention