SA0044 : Consider creating indexes on all columns included in foreign keys

The topic describes the SA0044 analysis rule.

Message

Consider creating indexes on all columns included in foreign keys

Description

The rule checks for not indexed foreign keys in the current database.

It is better to create indexes on all foreign keys, despite the possible overhead of maintaining unneeded indexes than not to have index when needed.

How to fix

Create an index on all foreign key columns as they are used in joins almost always benefit from having an index.

Scope

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

Parameters
Name Description Default Value
IndexNamePattern

The name of the new index that is generated for the CREATE INDEX statement by the rule fix.

IX_{parent_schema_name}{parent_table_name}_{nonindexed_columns_list}

Remarks

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

Effort To Fix
20 minutes per issue.
Categories

Performance Rules, Bugs

Additional Information

There is no additional info for this rule.

See Also

Other Resources