PrepAway - Latest Free Exam Questions & Answers

You need to improve the performance of the query

You use a Microsoft SQL Server 2012 database that contains two tables named
SalesOrderHeader and SalesOrderDetail. The indexes on the tables are as shown in the exhibit. (Click the Exhibit button.)

You write the following Transact-SQL query:

You discover that the performance of the query is slow. Analysis of the query plan shows
table scans where the estimated rows do not match the actual rows for SalesOrderHeader
by using an unexpected index on SalesOrderDetail.
You need to improve the performance of the query.
What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Use a FORCESCAN hint in the query.

B.
Add a clustered index on SalesOrderId in SalesOrderHeader.

C.
Use a FORCESEEK hint in the query.

D.
Update statistics on SalesOrderId on both tables.

Explanation:
References:
http://msdn.microsoft.com/en-us/library/ms187348.aspx

12 Comments on “You need to improve the performance of the query

  1. Yommy O. says:

    The FORCESEEK hint in a query forces the Query Optimizer to perform an index seek instead of a full table scan. However, if the optimizer is already “using an unexpected index on SalesOrderDetail”, while the “estimated rows do not match the actual rows for SalesOrderHeader”, then Option C will not achieve much difference. One needs to ‘update statistics for SalesOrderID column’ on both tables (Option D).




    0



    0

Leave a Reply