Databases Reference
In-Depth Information
Remove the hypothetical index by running this statement:
DROP
INDEX
dbo
.
SalesOrderDetail
.
cix_ProductID
Listing 4-16.
Finally, implement the DTA recommendation, this time as a regular clustered index:
CREATE
CLUSTERED
INDEX
cix_ProductID
ON
dbo
.
SalesOrderDetail
(
ProductID
)
Listing 4-17.
After implementing the recommendation and running the query again, the clustered
index is in fact now being used by the Query Optimizer. This time, the plan shows a
Clustered Index Seek operator and an estimated cost of 0.0033652, which is very close
to the recommended cost listed previously when querying the
msdb..DTA_reports_
query
table.
Finally, drop the table you just created by running the following statement:
DROP
TABLE
dbo
.
SalesOrderDetail
Listing 4-18.