Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This section includes the following topics:

 

...

  • About the SQL tab

 

...

  • How the SQL tab is structured

 

...

  • About tuning actions

...

 

...

About the SQL tab 

The SQL tab lets you analyze execution plans and explain results so that you can tune statements and achieve optimal results.

...

The following table shows from which tabs and entities it is possible to launch to the SQL tab, in context 

Table 7-1    Launch 1 Launch in-context to following entities 

Tab    Entities

Dashboard    Statement

...

What-If    Statement that is affected by one or more index evaluations. 

 

Note: If the SQL tab is opened with no statement in-context, the following error message is displayed:

No statement in context. Please open a statement.

 

 

In the Current tab, you can either launch the SQL tab by clicking the SQL tab button when the selected entity in the Main area is a statement, or by selecting a statement in the Association area and clicking the Tune icon that appears before the SQL text.

...

See “About the Current tab” on page 30. See “About the Activity tab” on page 39. See “About the Objects tab” on page 67. 

How the SQL tab is structured 

The following sections explain how to view information and navigate through the SQL tab:

 

...

  • About viewing the execution plan of a statement

 

...

  • About interpreting text highlighting on the Highlights tab

 

...

  • About viewing which objects are referenced by the execution plan

 

...

  • About viewing information on all operators and predicates in the Execution plan

 

...

  • About viewing the statement text

 

...

  • About viewing recommended indexes for a statement

 

...

  • About viewing additional execution plan details

...

 

...

About viewing the execution plan of a statement

...

Two types of execution plans are available when launching to the SQL tab: 

Virtual execution plan    The plan which was collected from DB2 V$ tables. Additional real-time statistics are available for these plans. For example, you can view a breakdown of In DB2 time for a plan as compared to other plans, or a breakdown of its I/O when accessing DB2 objects.

When launching to the SQL tab with a specific SQL statement in context, Precise for DB2 presents actual execution plan information, including actual plan steps, and information and statistics for multiple plans. For example, if a statement has several different execution plans, all are displayed. 

Estimated execution plan                Depending upon the version of DB2 running on your system, you may be only able to generate and run an estimated execution plan. At times, real execution plan information is lost (as when they are removed from the system before Precise for DB2 could access them). If this happens, all real-time statistics (such as, I/O, and In DB2) are considered to belong to other plans.

 

 

The Plan view is divided into three panes. The Plan Tree area and the Text View area are displayed in the left pane. The Details area is displayed in the right pane. The information displayed in the Details area is controlled by the information tabs (Highlights, Objects, Operators, Text, and Recommendations) that are located at the top of this area.

 

 

The following table describes the information displayed in each tab of the Plan view. 

Table 7-2    Information 2 Information tabs 

Information Tabs    Description

...

Operators    Displays information on all operators in the Execution plan tree. When you sort a table, you can locate operators by their total cost or by any other column in the table.

...

Recommendations    Displays new index recommendations for the statement. These are additional indexes that can improve the statement. 

Note: This tab is only displayed after you generate Recommendations (by clicking the

Recommend button or clicking Actions>Recommend. 

About the Execution Plan tree

...

The execution plan's text appears both in the Text View area (Text tab) at the bottom of the execution plan tree and at the top of the Details area (also a Text tab). The text that relates to the selected step in the Plan tree is highlighted. This lets you view the text of the statement, the execution plan, and additional information, such as the objects referenced by the statement, all at once. In the Text View area you can also view two additional tabs displaying Optimized Text and Remote Query Text. 

Actions that can be performed on the tree

You can perform the following actions on the execution plan tree:

 

...

  • The Playback controls, located at the top of the tree, enable you to freely move within the execution plan of an explained statement (step by step).

 

...

  • By moving the pointer over the execution plan steps, you can view a ToolTip that contains statistical information, such as Estimated Cost, Estimated Rows, and Estimated I/O Cost, and a description of the specified step.

 

...

  • Selecting a specific step (operator) highlights nested steps and affects the information displayed in the Detail tabs: the relevant Optimized text is shown on the Highlights tab; the referenced tables, indexes, and columns are shown on the Objects tab; the operators and predicates are shown on the Operators tab; and the Original text is shown on the Text tab. The Recommendations tab, only displayed when you generate recommendations, shows index details and the DDL for creating the indexes.

 

...

  • Clicking the hatchet mark (    ), located at the bottom of the tree, displays the Tree View area with three tabs allowing you to select which statement text to view:

      ...

        • Optimized Text

      ...

        • Original Text

      ...

        • Remote Query Text

      ...

       

      ...

      Note: When launching to the SQL tab, the Highlights tab in the Details area and the Text tab in the Text View area are selected by default.

       

       

      About interpreting text highlighting on the Highlights tab

      ...

      Only applied predicates are highlighted. In the following example, the predicate on the bid column is range delimiting.

       

       

       

      Note: Not all operators include color fonts. Color fonts are used only when relevant for performance tuning.

       

       

       

      About viewing which objects are referenced by the execution plan

      ...

      The following table describes the information displayed for the referenced tables. 

      Table 7-3    Tables 3 Tables used in Plan 

      Column    Description

       

       

       

          Click to launch to Objects tab—with the selected index in context—to get additional catalog information about the object.

      ...

      Total Pages    The total pages based on last statistics update.

       

       

      Table 7-3    Tables 3 Tables used in Plan

       

      Column    Description

      Data Pages    The data pages based on last statistics update.

      ...

      Preferred Locksize    Preferred locksize based on last statistics update. 

      The following table describes the information displayed in the indexes defined on a selected table.

       

      Table 7-4    Indexes 4 Indexes on Table. 

      Column    Description

       

       

       

          Click to launch to Objects tab—with the selected index in context—to get additional catalog information about the object.

      ...

      Density    Density based on last statistics update. 

      The following table describes the information displayed in Columns in Table. 

      Table 7-5    Columns 5 Columns in table 

      Column    Description

       

       

       

          Click to launch to Objects tab—with the selected table in context—to get additional catalog information about the object.

      ...

      Key Number    The position within the chosen index.

       

       

      About viewing information on all operators and predicates in the Execution plan

      ...

      The following table describes the information displayed in the Operators table.

       

      Table 7-6    Operators 6 Operators table 

      Column    Description 

           Click to locate and highlight in Bold font the same operator in the execution plan.

      ...

      Table Partitions    The estimated number of table partitions to be accessed. 

      The following table describes the information displayed in the Predicates table. 

      Table 7-7    Predicates 7 Predicates table 

      Column    Description

      Text    Predicate text.

      ...

      Sub Select    Indicates when the subquery used in this predicate is evaluated. 

      About viewing the statement text

      The Text tab displays the statement’s original text. 

       

      About viewing recommended indexes for a statement

      The Recommendations tab displays the output of the Recommend algorithm. The Recommendations tab is divided into three areas:

       

      ...

      • Recommendations table

       

      ...

      • Details area

       

      ■    DDL area

       

      ...

      • DDL area

      The following table describes the information displayed in the Recommendations table. 

      Table 7-8    Recommendations 8 Recommendations table 

      Column    Description

      Object    The name of the index.

      ...

      Columns    Columns participating in the index or Include Columns in the index. 

      The Details area displays statistical information of the recommended index. The DDL area displays the create index statement. 

      About viewing additional execution plan details

      You can view additional execution plan details by hovering over a specific execution plan row with the mouse. A ToolTip is displayed showing some of the following details, depending upon which row you are hovering over:

       

      ...

      • Operator Type

       

      ■    Description

       

      ...

      • Description
      • Estimated Total Cost

       

      ...

      • First row cost

       

      ...

      • Estimated I/O cost

       

      ...

      • Estimated CPU cost

       

      ...

      • Estimated communication cost

       

      ■    Contribution Ratio

       

      ...

      • Contribution Ratio
      • Estimated total cost

       

      ...

      • Operator Arguments such as:

          ...

            • MAXPAGES=ALL

          ...

            • PREFETCH=NONE

          ...

            • ROWLOCK=EXCLUSIVE

          ...

            • SCANDIR=FORWARD

          ...

            • TABLOCK=INTENT EXCLUSIVE

          ...

           

          ...

          About tuning actions

           

          Use the Actions menu to perform the following operations:

           

          ...

          • Creating a new statement

           

          ...

          • Opening an existing statement

           

          ...

          • Editing an existing statement

           

          ...

          • Re-explaining an access plan

           

          ■    Generating recommendations

           

          ...

          • Generating recommendations

          Creating a new statement

          You can create a new statement and save it in the PMDB in a logical cabinet and folder hierarchy. You can also rewrite statements and view their access plans.

           

           .

          To create a new statement

           

          ...

          1. On the Actions menu, click New.

          ...

          1. In the New Statement dialog box, choose the relevant properties for the new statement from the drop-down lists and enter a statement name, as follows:

             

            ...

              • Instance. The name of the instance that the statement belongs to.

             

            ...

              • User. The statement's parsing user.

             

            ...

              • Cabinet. The name of the cabinet that the statement is saved in (creates a cabinet if it does not already exist).

             

            ...

              • Folder. The name of the folder that the statement is saved in (creates a folder if it does not already exist).

             

            ...

              • Statement. The name of the statement.

             

            ...

              • Comment. User free text.

             

             

            ...

            1. Type the SQL text for the statement in the Text frame.

             

            ...

            1. Click OK.

            The new statement is saved in the PMDB in a logical cabinet and folder hierarchy.

             

             

            Opening an existing statement

            You can load a previously saved statement. To open an existing statement1    On

            1. On the Actions menu, click Open. The Open Statement dialog box is displayed.

            ...

            1. In the Open Statement dialog box, select the statement you want to open by choosing its relevant properties from the drop-down lists, as follows:

               

              ...

                • Database. The name of the database where the statement is running. Cabinet    The name of the cabinet that the statement is saved in. Folder    The name of the folder that the statement is saved in. Statement    The name of the statement.

              ...

               

              ...

                • Comment. Displays free text entered by the user.

              ...


                • The statement's text is displayed in the Text frame.

               

              ...

              1. Click OK.

              ...

               

              ...

              Note: If the SQL tab is opened with no statement in-context, the following error message is displayed:

              ...

              To open a statement you can close the error message dialog and click the Open button displayed on the upper right-hand side of the Details area or click Actions>Open. To open a new statement click Actions>New.

               

               

              Editing an existing statement

              You can edit a statement that was saved in the PMDB. The statement that was collected by the Collector is saved as a new statement in a logical cabinet and folder hierarchy.

               

               

              To edit an existing statement

               

              ...

              1. On the Actions menu, click Edit.

              ...

              1. In the Edit Statement dialog box, select the statement you want to edit by choosing its relevant properties from the drop-down lists, as follows:

                 

                ...

                  • Database. The name of the database where the statement is running.

                 

                ...

                  • User. The statement's parsing user.

                 

                ...

                  • Cabinet. The name of the cabinet that the statement is saved in. Folder    The name of the folder that the statement is saved in.
                  • Statement.

                ...

                  • The name of the statement.

                ...

                  • Comment. Displays free text entered by the user.

                 

                 

                ...

                1. Enter a new statement name in the Statement field.

                 

                ...

                1. Edit the SQL text for the statement in the Text frame.

                 

                ...

                1. Click OK.

                The edited statement is saved in a logical cabinet and folder hierarchy.

                 

                 

                Re-explaining an access plan

                ...

                To re-explain a statement

                 

                1    Go , go to Actions>Re-Explain or, alternatively, click the Re-Explain button.

                 

                 

                Generating recommendations

                ...

                To generate a recommendation

                 

                1    Go , go to Actions>Recommend or, alternatively, click the Recommend button. 

                 

                Precise. Performance intelligence from click to storage. Learn more > >

                ...