DF006: Index type (CLUSTERED or NONCLUSTERED) is not specified.

Last modified: December 25, 2024

The topic describes the DF006 T-SQL code analysis rule.

Category

BEST PRACTICE

Message

Index type (CLUSTERED or NONCLUSTERED) is not specified.

Description

In the CREATE INDEX statement, it is recommended to explicitly specify the type of an index: CLUSTERED or NONCLUSTERED.

Additional information

This ensures clarity and precision in the index definition, helping to avoid confusion and potential errors during index creation. Additionally, explicitly stating the index type allows for better control over the physical organization of data and can influence query performance and storage considerations.

Noncompliant code example

CREATE INDEX ByFirstName ON dbo.Customers(FirstName)

Compliant solution

CREATE NONCLUSTERED INDEX ByFirstName ON dbo.Customers(FirstName)