Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Optimisation as per execution plan
Message
De
25/10/2011 14:07:24
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Indexation
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01526170
Message ID:
01527328
Vues:
35
The problem in here seems to be related to this nested join which makes use of a Key Lookup, which in turn uses the primary key of the table. The primary key is, by default, Clustered, and we cannot change that. On a clustered index, we cannot add included fields. However, the Key Lookup identifies an output field and I just can't benefit of it in the index.

So, I tried to create another index on that primary key field, which would then be non-clustered. And, I added the included field in that one. However, the execution plan doesn't want to use that one. He sticks on using the clustered index.

And, this all depends on which field we use in the condition. If I use a different field from the same table, which also has an index, I can have a totally different execution plan.
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform