If the statement that you want to tune accesses global
temporary tables, you must run the statements that define the temporary
tables before you run analysis tools on your statement.
About this task
- If the SQL statement runs on DB2 for Linux, UNIX, and Windows,
you can create an access plan graph, analyze the access plan with
the Access Plan Explorer, or both.
- If the SQL statement runs on DB2 for z/OS, you can view a formatted
version of the statement, create an access plan graph, analyze the
access plan with the Access Plan Explorer, or do any combination of
these three options.
Procedure
To declare global temporary tables before tuning an SQL
statement:
- If the SQL statement runs on DB2 for Linux, UNIX, and Windows,
you can run the DDL statements from an SQL editor in the workbench
or from the workflow assistant.
- To open an SQL editor to run the DDL to declare global temporary
tables, in the Data Source Explorer right-click the database and select New
SQL Script. Paste the DDL statements into the editor and
click the Run icon.
- To run the DDL from the workflow editor, follow steps a through
d below.
The global temporary tables remain on the database until
you either explicitly close the connection to the database in the
Data Source Explorer, switch workspaces, or close the client.
- If the SQL statement runs on DB2 for z/OS, you must temporarily replace
the captured SQL statement with the DDL to create the global temporary
tables. Follow these steps:
- Copy and paste the captured SQL statement that is in
the Query Text field
into another location, such as a text editor.
- Type or paste the SQL statements that define the temporary
tables in the Query Text field.
- Click the Run SQL button. The result is displayed in the SQL Results view.
If the DDL runs successfully, proceed to the next step.
- In the Query Text field,
replace the statements that defined the tables with the captured statement.
While the current workflow assistant remains open, you
do not have to declare the global temporary tables again. However,
if you close and then reopen the workflow assistant to continue working
with the SQL statement, you must follow steps a through d again.
What to do next
Click the Select What to Run button
and select any of the available options for the connected DB2 data server.