1016
Part VII: Performance Tuning and Optimization
Path
No Path Desc Execution Plan Rows Cost Reads Missing IndexDuration
(ms)Rows
per msFilter by
Include
ColumnNC Ix Seek
(Seek
Predicate +
Predicate)1.0032 51 .027 Filter by 2 x
NC Indexes2 x NC Ix
Seek
(Predicate
Æ Merge
Join1.012 4 63 .028 Filter by
Ordered NC
Composite
IndexNC Ix Seek
(Seek
Predicate w/
2 prefi xes)1.0032 56 .029 Filter by
Unordered
NC
Composite
IndexNC Ix Scan 118 .209 173 NC by
missing
key,
include C
Key72 1.6410 Filter by
ExpressionN C I x S c a n 9. 2 0 9 173 111. 0 8The key performance indicators are the query execution plan optimizer costs (Cost), and
the number of logical reads (Reads).For the duration column, each query path was executed multiple times with the results
averaged. You should run the script on your own SQL Server instance, take your own per-
formance measurements, and study the query execution plans.The rows-per-ms column is calculated from the number of rows returned and the average
duration. Before executing each query path, the following code clears the buffers:DBCC FREEPROCCACHE;
DBCC DROPCLEANBUFFERS;Query Path 1 — Fetch All
The fi rst query path sets a baseline for performance by simply requesting all the data from
the base table.SELECT *
FROM Production.WorkOrder;TABLE 45 -1 (continued)c45.indd 1016c45.indd 1016 7/31/2012 10:16:39 AM7/31/2012 10:16:39 AM
http://www.it-ebooks.info