Same leading key column in unique constraint and nonclustered index - duplicate
3
votes
2
answers
198
views
These are two indexes on the table with the same leading key column.
First is a unique constraint with additional keys:
ALTER TABLE dbo.MyTable ADD CONSTRAINT UQ_MyTable_FirstColumn_SecondColumn_ThirdColumn
UNIQUE NONCLUSTERED
(
FirstColumn ASC,
SecondColumn ASC,
ThirdColumn ASC
)
And the second is a single-key nonclustered rowstore index:
CREATE NONCLUSTERED INDEX IX_MyTable_FirstColumn ON dbo.MyTable
(
FirstColumn ASC
)
Despite the benefit that the NC is smaller, I would consider it a **duplicate**. Am I missing something? No "de-dupe" script checker I am using agrees with me, so I am confused.
Asked by jericzech
(977 rep)
May 5, 2025, 07:51 AM
Last activity: May 5, 2025, 06:52 PM
Last activity: May 5, 2025, 06:52 PM