Databases Reference
In-Depth Information
5.
After creating clustered index on SalesOrdHeaderDemo table, table scan
disappears from the Execution plan but it is still there in SalesOrdDetailDemo
table. Let us try to remove table scan from the second table as well, by creating a
clustered index on SalesOrdDetailDemo table using the following query:
CREATE UNIQUE CLUSTERED INDEX idx_SalesDetail_SalesOrderlID ON
SalesOrdDetailDemo (SalesOrderID,SalesOrderDetailID)
GO
6. Again execute the same SELECT query to analyze the behavior of the operator:
SELECT
sh.SalesOrderID
FROM
SalesOrdHeaderDemo AS sh
JOIN
SalesOrdDetailDemo AS sd
ON
sh.SalesOrderID=sd.SalesOrderID
WHERE
sh.OrderDate='2005-07-01 00:00:00.000'
GO
7.
Analyze the Execution plan given in the next screenshot, which shows Clustered
Index Seek on the second table:
 
Search WWH ::




Custom Search