RPM1984
RPM1984

Reputation: 73123

Why are these SQL Server statistics outdated, when it's set to auto-update?

We have a SQL Server 2012 instance, with auto-statitics set to ON for the DB:

enter image description here

But then i ran a query to check some statistics, and some haven't been updated in a while:

enter image description here

  1. Why is this the case? Is there a rule to whether SQL Server updates statistics that haven't been triggered by these indexes?
  2. Do i need to care? How do i know if i need to update them, or if they are causing performance issues for me?

Thanks!

Upvotes: 3

Views: 2510

Answers (1)

TheGameiswar
TheGameiswar

Reputation: 28930

Even though you set Auto update statistics to true, they will update only when a threshold has been reached..this is different for different versions

Thresholds for SQL Server 2012 or older:

  1. The table size has gone from 0 to > 0 rows

  2. The number of rows in the table when the statistics were gathered was 500 or less, and the colmodctr of the leading column of the statistics object has changed by more than 500 since then

  3. The table had more than 500 rows when the statistics were gathered, and the colmodctr of the leading column of the statistics object has changed by more than 500 + 20% of the number of rows in the table when the statistics were gathered

For SQLServer 2016,there are few major changes and SQL Updates statistics with a new algorithm(read as more frequently than old versions)

Do i need to care? How do i know if i need to update them, or if they are causing performance issues for me?

Normally people schedule maintenance jobs during weekends and this includes index rebuild/stats update..

This should normally take care of most databases.In your case,if you are seeing performance issues due to invalid stats,you can update them manually.We do it once a week,but sites like StackOverflow does it more often

update stats tablename

Further reading/references:
Statistics Used by the Query Optimizer in Microsoft SQL Server 2008
Understanding When Statistics Will Automatically Update

Upvotes: 4

Related Questions