Walter Meester
HoogkarspelPays-Bas
Information générale
Forum:
Microsoft SQL Server
Versions des environnements
SQL Server:
SQL Server 2008
>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?
Can you post the query and execution plan? For optimal performance you might need a full covered index, meaning SQL does not have to touch the table, but runs the query solely from the index.
You can force the query with the WITH INDEX = MyIndex optimizer hint. Then you might be able to identify why this is not resolving the issue.
It also might depend on what percentage of the table is returned from the query. If selectivity is low, a table scan might be the fastest in stead of using an index.
Walter,
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement