Is there way to do it? I am currently facing problem as one index is being used unnecessarily in my query (as displayed in the execution plan of the query in sql server 2008) and it is degrading the query performance. This index can not be dropped as it is useful for some other query.
Share
You can give SQL Server a query hint, e.g. force it to use a specific index – but to my knowledge, there’s no way to prevent it from using a specific index. Can you find some other index that your query in question could use instead?
Also, with SQL Server 2008, you have new additional query hints, called
OPTIMIZE FOR, which might help you define (and explain) to the query optimizer what it should optimize for.See the MSDN documentation on query hints for complete details.
This is the typical and fundamental tradeoff you must make when adding indices – yes, it might increase performance of one query you’re looking at – but at the same time, it might decrease others. There’s really no easy solution here – either the gain for the other query is greater than the pain for this query – then keep the index. Otherwise drop it.