1. | What is the easiest way to display the execution plan designed by the query optimizer? |
|
2. | What Transact-SQL code can be used to represent the execution plan as an XML string? |
|
3. | What is the main advantage of using a plan guide versus the USE PLAN query hint? |
|
4. | What is the correct format for a searchable argument (SARG) that is needed by the query optimizer to determine the optimal execution plan? |
|
Answers
1. | You can view a graphical representation of the execution plan without actually executing the code by selecting Display Estimated Execution Plan from the Query menu. |
2. | You can execute SET SHOWPLAN_XML ON from a query window. Until the option is turned off, all SQL statements will not execute and will instead return an XML string that represents the execution plan selected by the query optimizer. |
3. | Plan guides are useful when attempting to resolve problems with poorly performing queries from third-party applications or any application where the source code is not modifiable. |
4. | For a searchable argument to be valid, the left side of the operator should be a column, and the right side should be a constant or a variable. |