The execution plan displays the steps a database takes to execute a SQL statement. You can use the execution plan to determine if a statement is efficient.
Each step of the tree indicates how SQL Optimizer retrieves rows of data. The first line of the execution plan displays the SQL statement type, such as SELECT. The remaining lines represent an operation. The operations are numbered in the order of execution to make the plan easier to read.
SQL Optimizer executes each child operation before the parent operation. For some SQL statements, SQL Optimizer executes the parent operation once it retrieves a single row from the child operation. Other SQL statements require that SQL Optimizer retrieve all rows from the child operation before it executes the parent operation.
The annotated execution plan includes the following information for each step:
Execution order number
Join syntax (annotated)
Filter syntax (annotated)
Object name
Table access
Index scan
Cost
Partition name
The Execution Plan window contains an Estimated Plan tab, an Actual Plan tab, and a Virtual Plan tab.
The Estimated Plan is generated by the SHOWPLAN command.
The Actual Plan is retrieved after executing SQL and includes real statistics such as Actual Rows, Actual Rebinds and Actual Rewinds that are not in an estimated plan.
Virtual Plan is an estimated plan retrieved with hypothetical indexes created.
The execution plan displays the steps a database takes to execute a SQL statement. You can use the execution plan to determine if a statement is efficient.
Each step of the tree indicates how SQL Optimizer retrieves rows of data. The first line of the execution plan displays the SQL statement type, such as SELECT. The remaining lines represent an operation. The operations are numbered in the order of execution to make the plan easier to read.
SQL Optimizer executes each child operation before the parent operation. For some SQL statements, SQL Optimizer executes the parent operation once it retrieves a single row from the child operation. Other SQL statements require that SQL Optimizer retrieve all rows from the child operation before it executes the parent operation.
The annotated execution plan includes the following information for each step:
Execution order number
Join syntax (annotated)
Filter syntax (annotated)
Object name
Table access
Index scan
Cost
Partition name
The Execution Plan window contains an Estimated Plan tab, an Actual Plan tab, and a Virtual Plan tab.
The Estimated Plan is generated by the SHOWPLAN command.
The Actual Plan is retrieved after executing SQL and includes real statistics such as Actual Rows, Actual Rebinds and Actual Rewinds that are not in an estimated plan.
Virtual Plan is an estimated plan retrieved with hypothetical indexes created.
SQL Optimizer automatically retrieves the execution plan when you optimize or execute a SQL statement. The Execution Plan window contains an Estimated Plan tab and an Actual Plan tab. When you generate an index or user alternative, the Virtual Execution Plan tab also displays.
Note: When you generate virtual index alternatives, the execution plan is not retrieved for the SQL statement because SQL Optimizer does not physically create indexes on the database. See Fill Missing Estimated Plans for more information.
The Estimated Plan is generated by the SHOWPLAN command.
To get an estimated plan
Do one of the following:
- Click .
- Select the Estimated Plan tab and click Get Estimated Plan.
The Actual Plan is retrieved after executing SQL and includes real statistics such as Actual Rows, Actual Rebinds and Actual Rewinds that are not in an estimated plan.
To get an actual plan
After generating SQL alternatives, to retrieve the actual plan for the selected alternative, do one of the following:
- Test run the selected SQL alternative.
- Select the Actual Plan tab (for the selected SQL) and click Test Run - Current.
Tips for both Estimated and Actual Plans:
Use the Plan toolbar (right side of pane in tree view) to select from several options that display different plan details (operators, predicates, statistics).
Note: The Actual Plan tab displays an additional button at the top of the Plan toolbar. Click the Plan Comparison button to display a comparison of estimates and actual statistics.
The Virtual Plan is an estimated plan retrieved with hypothetical indexes created. See Create Virtual Indexes and Generate Index Alternatives for more information.
Right-click in the Execution Plan window to select from the following actions:
Action | Description |
Copy | Copies the execution plan to the clipboard. |
Save | Saves the execution plan as a JPG file. |
Opens the print window so you can print the execution plan. | |
Style |
Select a style type for displaying the plan. |
View Plan | Allows you to change how the execution plan is viewed. |
Step Description | Select this option to display a description of the step selected in the execution plan. |
Plan Information | If you select this option, SQL Optimizer identifies whether an execution plan uses any of the following: cardinality feedback, dynamic sampling, SQL plan directives, or adaptive plan. If applicable, the information displays in the Execution Plan pane directly above the Execution Plan tab. |
Animate Plan Steps | Highlights, one-by-one, the execution plan steps. |
View Missing Indexes | Create a user-defined alternative. |
Generate Indexes | Explore different index alternatives. |
Plan Options | Opens the Execution Plan Options window so you can select which information is displayed in the execution plan and whether to display specific items in a column. |
Help on SELECT | Displays definition of SELECT operator. |
Help on Execution Plan | Opens online help for the Execution Plan window. |
When you generate virtual index alternatives, SQL Optimizer retrieves virtual execution plans because the indexes are not physically created on the database. You can retrieve execution plans for index alternatives by creating temporary indexes. SQL Optimizer drops the temporary indexes once it retrieves the execution plans.
To fill a missing estimated plan
Select an index alternative in the Alternatives pane. The Virtual Plan tab displays by default in the Execution Plan pane.
© 2024 Quest Software Inc. ALL RIGHTS RESERVED. Termini di utilizzo Privacy Cookie Preference Center