Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Right index but not taken
Message
From
15/01/2014 14:38:51
 
General information
Forum:
Microsoft SQL Server
Category:
Indexing
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01591957
Message ID:
01591963
Views:
35
>You can force usage of a specific index, but normally it's not a recommended approach. Is the query very complex?
>
>Are you running in development environment where you can afford to get rid of all plans?

No, I wouldn't want to force it. I want SQL Server to be smart enough and use the more optimized index.

However, this is not the first time I see this. Whenever the primary key is used in a combined index, sometimes, SQL Server will decide to simply rely on the clustered index of the primary key and use that one. However, we cannot have included fields in a clustered index. So, this is why I created another index, on the primary key, with the two included fields I need. This is necessary to avoid the Key Lookup in the execution plan.

So, I really do not know how to workaround this. It is a very particular situation.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform