Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Would index tag speed up this SQL Select
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Indexation
Versions des environnements
SQL Server:
SQL Server 2014
Application:
Web
Divers
Thread ID:
01621119
Message ID:
01621159
Vues:
51
>>Is this because the column ORDER_NO is the primary key?
>
>Imagine you have your table (data file) like this:
>REC_ID, ORDER_NO, ....
>
>and your index is on REC_ID so the index file is
>REC_ID
>
>then SQL server needs to read two files, first it reads the index to answer the "which records" question, getting a pointer to the data table, from where it reads the ORDER_NO field, but if in your index file, in the "Tag" REC_ID you already have the ORDER_NO value, then there is no need to go and read the data file. as the index file is acting as both index and data (ORDER_NO does not participate on the record selection at all, it is just a copy of the data included in the index). Of course then you need to ponder speed vs space, as you are essentially duplicating your data

Thank you for the explanation. I will have to think about what order would work better, REC_ID, ORDER_NO or ORDER_NO, REC_ID. I suppose that execution plan would show me.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform