SQL/MX 3.x Query Guide (H06.22+, J06.11+)
HP NonStop SQL/MX Query Guide—640323-001
4-1
4
Reviewing Query Execution Plans
Use the information in this section to display and understand how your query is
optimized. At a later time, you might use this information to make decisions about
forcing execution plans, described in Section 5, Forcing Execution Plans.
•
Displaying Execution Plans on page 4-1
•
Using the EXPLAIN Statement to Review the Execution Plan on page 4-6
•
Optimization Tips on page 4-9
•
Reviewing Run-Time Statistics on page 4-21
Displaying Execution Plans
Use these methods to display the query execution plan:
•
Use the EXPLAIN function to query and display certain columns or all columns of
information about execution plans.
•
Use the EXPLAIN statement shortcut to display all available information about
execution plans.
•
Use the Visual Query Planner graphical user interface (GUI) to extract and display
execution plans generated by the SQL/MX optimizer for DML statements.
When you view information using the EXPLAIN function, the results are displayed in
the machine-readable format. However, when you use the EXPLAIN statement to view
the information, the results are displayed in the machine-readable format. Although you
can interpret the results of the execution plans, you can view results better using the
Visual Query Planner application.
Using the EXPLAIN Function
The EXPLAIN function is a table-valued stored function that returns information about
execution plans for SQL DML statements. You can use the information in the EXPLAIN
output for these types of tasks:
•
Reviewing the chosen execution plan.
•
Identifying problems and tuning queries.
•
Determining whether the optimizer chose the optimal plan.
You can query and display certain columns or all columns of the information about
execution plans by using the EXPLAIN function.
You can selectively display columns from the execution plan by using the EXPLAIN
function:










