Since subqueries can contain the same clauses that regular queries contain, their showplan output can include many of the messages listed in earlier sections.
The showplan messages for subqueries, shown in “Subquery optimization” on page 129 in the Performance and Tuning: Optimizer, include delimiters so that you can spot the beginning and the end of a subquery processing block, the messages that identify the type of subquery, the place in the outer query where the subquery is executed, and messages for special types of processing that is performed only in subqueries.
The showplan messages for subqueries include special delimiters that allow you to easily spot the beginning and end of a subquery processing block, messages to identify the type of subquery, the place in the outer query where the subquery is executed, or special types of processing performed only in subqueries
Message |
Explanation |
---|---|
Run subquery N (at nesting level N). |
This message appears at the point in the query where the subquery actually runs. Subqueries are numbered in order for each side of a union. |
NESTING LEVEL N SUBQUERIES FOR STATEMENT N. |
Shows the nesting level of the subquery. |
QUERY PLAN FOR SUBQUERY N (at nesting level N and at line N). END OF QUERY PLAN FOR SUBQUERY N. |
These lines bracket showplan output for each subquery in a statement. Variables show the subquery number, the nesting level, and the input line. |
Correlated Subquery. |
The subquery is correlated. |
Non-correlated Subquery. |
The subquery is not correlated. |
Subquery under an IN predicate. |
The subquery is introduced by in. |
Subquery under an ANY predicate. |
The subquery is introduced by any. |
Subquery under an ALL predicate. |
The subquery is introduced by all. |
Subquery under an EXISTS predicate. |
The subquery is introduced by exists. |
Subquery under an EXPRESSION predicate. |
The subquery is introduced by an expression, or the subquery is in the select list. |
Evaluate Grouped ANY AGGREGATE. Evaluate Grouped ONCE AGGREGATE. Evaluate Grouped ONCE-UNIQUE AGGREGATE. or Evaluate Ungrouped ANY AGGREGATE. Evaluate Ungrouped ONCE AGGREGATE. Evaluate Ungrouped ONCE-UNIQUE AGGREGATE. |
The subquery uses an internal aggregate. |
EXISTS TABLE: nested iteration |
The query includes an exists, in, or any clause, and the subquery is flattened into a join. |
For information about how Adaptive Server optimizes certain types of subqueries by materializing results or by flattening the queries to joins, see “Subquery optimization” on page 129 in the Performance and Tuning: Optimizer.
For basic information on subqueries, subquery types, and the meaning of the subquery predicates, see the Transact-SQL User’s Guide.