Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Can we Prioritize which index to be used first in a Select query ? Expand / Collapse
Author
Message
Posted Saturday, September 15, 2012 9:31 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, April 10, 2013 1:07 PM
Points: 26, Visits: 88
Can we Prioritize which index to be used first in a Select query? if so how can this be done.
Post #1359815
Posted Saturday, September 15, 2012 9:59 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, November 6, 2014 1:00 PM
Points: 5,333, Visits: 25,277
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

Before posting a performance problem please read
Post #1359820
Posted Saturday, September 15, 2012 10:30 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: 2 days ago @ 2:01 PM
Points: 40,390, Visits: 36,823
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 2008, MVP
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

Post #1359824
Posted Sunday, September 16, 2012 2:22 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, August 18, 2014 3:04 AM
Points: 1,331, Visits: 15,269
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.
Post #1359870
Posted Sunday, September 16, 2012 5:23 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, April 10, 2013 1:07 PM
Points: 26, Visits: 88
Thanks for your help!
Post #1359880
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse