This is actually more complicated than it sounds - a typical modern DBMS (and MS SQL Server is no exception) sometimes performs a full table scan, even if the index is available, simply because it can be faster with small amounts of data. 1
Example:
What else, the decision that the DBMS makes may depend on how fresh / accurate the statistics are .
The most reliable test for using the index is to simply populate your database with representative amounts of data , and then see the execution plan . And do not forget the time of the actual execution of the request while you are on it!
1 Simplified example: if the whole table fits into one page of the database, itβs faster to just load this page and go through it sequentially than wait for additional I / O for the page with the index.
source share