Database Reference
In-Depth Information
A simple SELECT statement run against the table that will use this new index will look something like this:
SELECT a.*
FROM Person.Address AS a
WHERE a.City = 'Dresden';
The I/O and execution time for the query is as follows:
Table 'Address'. Scan count 1, logical reads 74
CPU time = 0 ms, elapsed time = 209 ms.
And the execution plan in Figure 8-14 shows the use of the index.
Figure 8-14. Execution plan for query against leading edge of index
So, this query is taking advantage of the leading edge of the index to perform a Seek operation to retrieve the data.
If, instead of querying using the leading edge, you use another column in the index like the following query:
SELECT *
FROM Person.Address AS a
WHERE a.PostalCode = 'WA3 7BH';
the results are as follows:
Table 'Address'. Scan count 1, logical reads 211
CPU time = 16 ms, elapsed time = 267 ms.
And the execution plan is clearly different, as you can see in Figure 8-15 .
 
Search WWH ::




Custom Search