Database Reference
In-Depth Information
14. Execute the following TSQL statement:
--Check the execution plan without executing the query
USE Adventureworks2008R2
GO
SET STATISTICS IO ON
GO
SET SHOWPLAN_ALL ON
GO
--Using FORCESEEK hint
SELECT TransactionID, ProductID,TransactionDate,ModifiedDate FROM
Production.TransactionHistoryArchive
WITH (FORCESEEK)
WHERE ProductID >710 AND
ModifiedDate >= '2007-01-01'
GO
15. The query execution plan displays as follows:
16. Observe the difference between the EstimatedIO, EstimatedCPU, and
TotalSubtreeCost columns.
17. Also, let us execute the following TSQL to use the newly created nonclustered
index by selecting Include Actual Execution Plan from the Query option in SSMS:
--Choose Include Actual Execution Plan option
--Using FORCESEEK hint
SELECT TransactionID, ProductID,TransactionDate,ModifiedDate FROM
Production.TransactionHistoryArchive
WITH (FORCESEEK ,INDEX (IX_TransactionHistoryArchive_
ModifiedDate))
WHERE ProductID >710 AND
ModifiedDate >= '2007-01-01'
GO
 
Search WWH ::




Custom Search