SA0045 : Consider updating statistics as they appear outdated and may mislead the query optimizer |
![]() |
Outdated statistics in SQL Server can lead to inefficient query execution plans, causing slower performance and increased resource consumption.

Statistics in SQL Server provide critical information that the query optimizer uses to make informed decisions about the most efficient way to execute a query. Outdated statistics can mislead the optimizer, leading to suboptimal query plans.
For example:
1-- Example of a query potentially affected by outdated statistics 2SELECT * FROM LargeTable WHERE ColumnA = 'Value';
In this example, if the statistics on LargeTable.ColumnA are outdated, SQL Server may choose a non-optimal execution plan, such as a table scan instead of using an index, if it overestimates or underestimates the number of qualifying rows.
-
Query performance degradation due to incorrect estimates of result set sizes, affecting resource use.
-
Increased CPU and memory usage, potentially leading to server resource bottlenecks.

This rule addresses outdated statistics that can lead to inefficient query execution plans in SQL Server. Maintaining updated statistics ensures optimal performance and resource utilization.
Follow these steps to update table statistics and resolve the issue:
-
Open SQL Server Management Studio (SSMS) and connect to your database instance.
-
Identify the tables with outdated statistics that require updates. You can use the sys.dm_db_stats_properties to view statistics details.
-
Run the UPDATE STATISTICS command to refresh the statistics for the impacted table, specifying the table name. For example:
-
If necessary, consider using the WITH FULLSCAN option to ensure a more thorough update of the statistics.
For example:
1-- Example of updating statistics for a specific table 2UPDATE STATISTICS LargeTable WITH FULLSCAN;

The rule has a ContextOnly scope and is applied only on current server and database schema.

Name | Description | Default Value |
---|---|---|
EvaluationMode |
The parameters specifies the rules used to evaluate the statistics and consider them outdated or not. |
ModifiedRows |
ExpirationDays |
Number of days the after which statistics are considered outdated. The parameter is used only when the EvaluationMode is set to Period or Any. |
3 |

The rule requires Analysis Context. If context is missing, the rule will be skipped during analysis.


Performance Rules, Maintenance Rules, Bugs

There is no additional info for this rule.
