HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Okay to merge included columns on otherwise identical indexes?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
columnsmergeokayidenticalindexesincludedotherwise

Problem

I have two indexes that index the same field on the same table. The only difference between them is the included columns.

There's no reason I shouldn't combine the included columns and just have one index, right?

Solution

Yes, you should merge these indexes and only keep one, as long as you verify that:

-
Neither of them are marked as UNIQUE (in which case, preserve that one)

-
Neither of them have a filter condition

-
Neither of them are expressly referenced in an index hint

Context

StackExchange Database Administrators Q#234982, answer score: 7

Revisions (0)

No revisions yet.