Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
Returns the optimization strategy of a SQL statement as a plain text string.
[ , cursor-type ]
[, update-status ]
EXPLANATION( string-expression )
The SQL statement, which is commonly a SELECT statement, but can also be an UPDATE, MERGE, or DELETE statement.
The statement's access plan is returned as a string. For information about interpreting the result, see Advanced: Query execution plans.
The GRAPHICAL_PLAN function offers significantly greater information about access plans, including system properties that
may have affected how the statement was optimized.
This information can help you decide which indexes to add or how to structure your database for better performance.
The following statement passes a SELECT statement as a string parameter and returns the plan for executing the query:
SELECT EXPLANATION( 'SELECT * FROM Departments WHERE DepartmentID > 100' );