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:
01621150
Vues:
53
>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
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform