5

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?

  • You do of course make than one index bigger than each more narrow index. This can have an impact for scan operations. Probably nothing to worry too much about, but just to point it out. – Tibor Karaszi Apr 17 at 6:47
7

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

  • Thanks. I just combined like 5 indexes and shed close to a gigabyte of data, lol. :) – BVernon Apr 17 at 0:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.