Index related question

  • I am joing few tables on 3 columns - 2 of them are integers and 1 is a varchar. Should i create a composite index with these three columns on the joining tables or three individual indexes on all the joing tables

  • 1 index.

    SQL Server won't use multiple indexes usually. It just makes more work for it. Should be one index, and you'll need to pick the leading edge (first column in the index) based on your query and on selectivity of the columns involved. The one with the most selective values should usually lead the index.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • http://sqlinthewild.co.za/index.php/2010/09/14/one-wide-index-or-multiple-narrow-indexes/

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply