Home » Microsoft » 70-473 v.2 » What should you do?
Your company identifies a stored procedure that runs slowly.
You review the execution plan for the stored procedure, and you discover the properties of a Clustered Index Scan operator as shown in the exhibit. (Click the Exhibit button.)
The stored procedure contains the following code:
You need to improve the performance of the stored procedure.
What should you do?
A. Add a FORCESEEK query hint to the SELECT statement.
B. Add a NOLOCK query hint to the SELECT statement.
C. Convert the table to an In-Memory OLTP optimized table.
D. Change the FileName column from varchar(512) to nvarchar(512).
E. Change the @FileName parameter from nvarchar(512) to varchar(512)
Correct Answer: D
Explanation/Reference:
Match the datatype of the columns and values used in the query where the comparison is happening. We change the datatype of column.
Note:
Q: What is CONVERT_IMPLICIT?
A: When SQL Server encounters two different datatype’s comparison in either WHERE clause or JOIN clause, one side of the values will be converted to the datatype of another side. This process is very CPU, IO and Memory consuming.
Q: What is the negative impact of CONVERT_IMPLICIT?
A: Whenever CONVERT_IMPLICIT function encountered by a query, usually it takes way more resources than the normal case. The usage of CPU, IO and Memory goes high. Additionally, if the conversion is happening over the column of the table, all the values of the column will be converted to new datatype which will slow down your query in proportion to a size of the table.
Incorrect Answers:
E: We are not sure of the datatype of the FileName column. It could be varchar(256), for example.
References:
https://blog.sqlauthority.com/2018/06/11/sql-server-how-to-fix-convert_implicit-warnings/