Click or drag to resize

SA0045 : Consider updating statistics as they appear outdated and may mislead the query optimizer

The topic describes the SA0045 analysis rule.

Message

Consider updating statistics as they appear outdated and may mislead the query optimizer

Description

The rule checks the statistics on all tables and indexed views in the current database for outdated statistics.

Evaluation of the statistics can be based on the number of modified rows or on the last time the statistics were updated.

The rules used to evaluate the statistics using the number of modified rows are the same as the rules SQL Server uses to update statistics automatically.

These rules are as follows:

- If a table has 6 or fewer rows, statistics will be updated after 6 changes

- If a table has 500 or fewer rows, statistics will be updated after 500 changes

- If a table has more than 500 rows, statistics will be updated after 20% of the total rows plus 500 rows are modified,added or deleted

Scope

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

Parameters
NameDescriptionDefault 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

Remarks

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

Categories

Performance Rules, Maintenance Rules

Additional Information

There is no additional info for this rule.

See Also

Other Resources