Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Right index but not taken
Message
De
16/01/2014 00:33:36
 
 
À
15/01/2014 14:19:50
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:
01591978
Vues:
60
This message has been marked as a message which has helped to the initial question of the thread.
>I have an index on all tables with the primary key, which is clustered. That index is the default one and does not have any other field combined nor any included fields.
>
>I just created a new index on the primary key with the inclusion of two fields to satisfy the optimization of one particular SQL select command. To my surprise, the execution plan does not pick it up. The execution plan still takes the main primary key index.
>
>How can I avoid that situation?

Quite often you can force a certain index using a function with nonessential info added in front of order of resolving - which in itself of course is minimally less performant as it causes unnecessary cpu cycles - like "!" + pk + field1 + field2 for a where-clause and changing the wish-to-be-used index likewise. If the targeted index shows perfomance better by a large amount, the cpu cycles generated by the "!" should not matter that much...

HTH

thomas
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform