Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Right index but not taken
Message
 
 
À
15/01/2014 14:38:51
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Indexation
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01591957
Message ID:
01591965
Vues:
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.

Do you have a problem with optimizer picking up that plan? How did you come up with the alternative index - was it suggested as missing index when you run this query through DTA?

Also, another possibility is to send this query to SQL Sentry http://sqlsentry.net/plan-explorer/sql-server-query-view.asp for analysis.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform