General - Do you use a SQL Server Indexes Naming Standard?

Updated by Brook Jeynes [SSW] 1 year ago. See history

123

This standard outlines the procedure on naming Indexes at SSW for SQL Server. Use this standard when creating new Indexes or if you find an older Index that doesn't follow that standard. Note: There is not a lot of use naming Indexes - we only do it when we are printing out documentation or using the 'Index Tuning Wizard' - then it becomes really handy.

Index names are to have this syntax:

[pkc_] [TableName] by [FieldName] [1] [2] [3]

[1] All indexes must have a corresponding prefix.

PrefixType
pkc_Primary Key, Clustered
pknc_Primary Key, Non Clustered
ncu_Non Clustered, Unique
cu_Clustered, Unique
nc_Non Clustered (Most Common)

Make unique index name if possible. Ie. ProductName

[2] The name of the table that the Index refers to. [3] The name of the column(s) that the Index refers to.

Index 'BillingID'
Primary Key 'aaaaaClient\_PK'

❌ Figure: Figure: Bad Example

'nc\_ClientDiary\_BillingID'
'pknc\_ClientDiary\_ClientID'

✅ Figure: Figure: Good Example

acknowledgements
related rules