DB2 Version 9.7 for Linux, UNIX, and Windows

Viewing the history of previously explained query statements

Use the Explained Statements History window to view the history of previously explained SQL or XQuery statements for a selected database.

About this task

Each entry is an explained statement that is associated with either:
Tasks
  • Use the Statement menu to view a graphical representation of an access plan, to dynamically explain a query statement, to view text for a query statement, or to change or remove a query statement.
  • Use the View menu, or the icons on the secondary toolbar to sort, filter, or customize the explainable statements. You can also save the contents of this window using the options in this menu.
To open Explained Statements History window, do one of the following:
  • From the Control Center, expand the object tree until you find the Databases folder, expand the folder until you find the database you want, and then do one of the following:
    • Right-click the database and select Show Explained Statements History from the pop-up menu, or select Selected > Show Explained Statements History.
    • Highlight the database and select Selected > Show Explained Statements History.
  • From the Control Center, expand the object tree until you find the Packages folder (under the Application Objects folder). Then:
    • click the Packages folder. Any existing package objects are displayed on the right side of the window.
    • Right-click the package that you want, and select Show Explained Statements History from the pop-up menu; or highlight the package and select Selected > Show Explained Statements History; or simply double-click the package.
  • From the Explainable Statements window, select Statement > Show Explained Statements.

    If a statement is selected in the Explainable Statements window, the Explained Statements History window shows all of the explained statements that are related to the selected SQL statements.

    If no statement is selected, the Explained Statements History window shows all the explained statements that are related to the package that the explainable statements are in.

The Explained Statements History window might or might not contain explained statements, depending on whether the explain tables exist.

Reading the contents of the Explained Statements History window

The columns in the window provide the following information about the query statements that have been explained:
Package name
The name of the package that either:
  • Contains the SQL or XQuery statement (in the case of a static query)
  • Issued the SQL or XQuery statement (in the case of a dynamic query).
Package creator
The user ID of the user who created the package.
Package version
The version number of the package.
Explain snapshot
States whether an explain snapshot has been taken for the SQL or XQuery statement. (If it has not, you cannot view an access plan graph for the statement.)
Latest bind
If the statement is contained in a package, this field indicates whether or not the statement is associated with the latest bound package.
Dynamic explain
States whether the explained query statement was dynamic. (If it was not, it was a static or SQL or XQuery statement in a package.)
Explain date
The date when the statement had an explain operation performed on it.
Explain time
The time when the statement had an explain operation performed on it.
Total cost
The estimated total cost (in timerons) of the statement.
Statement number
The line number of the SQL or XQuery statement in the source module of the application program.
Section number
The number of the section within the package that is associated with the SQL or XQuery statement.
Query number
The query number that is associated with the statement.
Query tag
The query tag that is associated with the statement.
Query text
The first 100 characters of the original SQL or XQuery statement. (Use the scroll bar at the bottom of the window to scroll through it.) To view the complete SQL or XQuery statement, select Statement–>Show Query Text.
Remarks
Any remarks associated with the statement. (For example, for a static query statement, the remark associated with the package containing the statement.)