Can we Prioritize which index to be used first in a Select query ?

  • Can we Prioritize which index to be used first in a Select query? if so how can this be done.

  • Do not know if this will do exactly what you want to do, but read here:

    http://msdn.microsoft.com/en-us/library/ms181714(v=sql.100).aspx

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • The optimiser chooses the best index for a query based on its knowledge of the data distribution, rows involved and a few other factors.

    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
  • You can but I would only advise this in exceptional circumstances like you are not in a position to updates stats on a very, very large table or in a high tps environment. In a sense "dont try this at home" unless under supervision of an adult or an experienced dba.

    Adding WITH(INDEX=idx_i_am_an_index) just after the table name or alias.

    Another alternative is adding OPTION(FORCE ORDER) enforces the join order of the query given.

  • Thanks for your help!

Viewing 5 posts - 1 through 4 (of 4 total)

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