70-461 Free Dumps Study Materials
Question 14: You are the administrator for a heavily-used OLTP Microsoft SQL Server database.
You are troubleshooting performance issues seen when using stored procedures in the database. The
database stores millions of orders across thousands of customers. Some of the customers have large
numbers of orders, while others have only one order. You update the statistics and perform
defragmentation of all tables and indexes, but two stored procedures still have issues when accessing
data.
p_GetCustomer accepts @companyID as a parameter. From the results of profiling, you know that 90
percent of the calls use the @companyid value of 5, while the other 10 percent of calls are evenly
distributed across another 10000 values. While viewing the execution plan, you discover that a non-
clustered index seek is used.
p_GetShipDate accepts @orderID as a parameter and returns the ship date for that order. You
discover that the execution plan is performing a scan on a non-clustered index that has orderID as the
index key.
You need to add appropriate query hints to each stored procedure to improve the performance.
What should you do? To answer, drag the appropriate procedures to the correct hints. Each
procedure may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.
Correct Answer:Explanation:
Box 1: Optimize FOR..
OPTIMIZE FOR ( @variable_name { UNKNOWN | = literal_constant } [ , ...n ] ) Instructs the query
optimizer to use a particular value for a local variable when the query is compiled and optimized. The
value is used only during query optimization, and not during query execution.
Box 2: FORCESEEK
FORCESEEK [ (index_value(index_column_name [ ,... n ] )) ]
Specifies that the query optimizer use only an index seek operation as the access path to the data in
the table or view.
References:
https://docs.microsoft.com/en-us/sql/t-sql/queries/hints-transact-sql-query?view=sql-server-2017
https://docs.microsoft.com/en-us/sql/t-sql/queries/hints-transact-sql-table?view=sql-server-2017