Capturing SQL statements from statement caches

Use the Capture SQL from Statement Cache page of the workflow assistant for query tuning to find and select an SQL statement from the dynamic statement cache. You can then analyze the statement, tune it, or both.

Before you begin

About this task

The dynamic statement cache caches all dynamic SQL statements that run on the subsystem. When IFCID 0318 is enabled, the dynamic statement cache also retains performance data about the cached SQL statements.

Procedure

To capture an SQL statement from the dynamic statement cache:

  1. In the Data Source Explorer, right-click the database on which the statement cache is located.
  2. Select Query Tuner > Start Tuning. The workflow assistant for query tuning opens to the Capture section.
  3. On the left side of the workflow assistant, select Statement Cache under DB2 for z/OS Sources.
  4. Create a filter, or select an existing one, that sets criteria for how to find the SQL statement that you want.
  5. Click Capture. After you capture SQL statements that match the criteria, the Captured Statements section opens. The captured SQL statements appear in a table in this section. You can sort the statements by clicking the column headers in the table.
  6. Right-click the statement that you want to analyze and tune, and select Invoke Advisors and Tools.
    The workflow assistant for query tuning opens to the Run Single-Query Advisors and Analysis Tools page of the Invoke section. The statement appears in the Query Text field.

    Run advisors and tools on the statement. For help on the Run Single-Query Advisors and Analysis Tools page, click the Help button at the top of the page or in the two sections. You can also click at the top of the page or in a section and then press F1.


Feedback