Use the Compare section
of the workflow assistant for query tuning to compare two versions
of an SQL statement that has been revised from its original state.
Before you begin
- Ensure that both versions of the SQL statement that you want to
use for comparison have been formatted with the query formatter analysis
tool. See Formatting SQL statements.
- Run the advisors on at least one of the SQL statements that you
want to use for comparison and follow the generated recommendations
to revise it. See Revising SQL statements and Changing access paths.
About this task
By comparing two versions
of an SQL statement that have been formatted with the query formatter
analysis tool, you can identify the changes that were made to the
most recent version. You can compare SQL statements from the same
project, or across multiple projects.Note: The query formatter analysis tool
is not the same as the Format SQL button. To
run the tool, go to the Invoke section of the
workflow assistant. Then, click the Select What to Run button.
In the window that opens, select the Format and annotate
SQL statement option and then click OK.
Procedure
To compare two SQL statements:
- In the workflow assistant, go to the Compare section
and click Query Text Comparisons under the Single
Query menu.
The comparison page opens
and shows the SQL statements that you can compare. If you saved your
SQL statement before you made changes to it, you can compare the latest
version of the SQL statement with the saved version.
In
the example in following table, Query 1 was saved before changes were
made, and Query 2 was saved after changes were made.
Table 1. The two lists that appear for this example situation| Left side |
Right side |
 |
 |
- Click the Compare button at the
top of the page.
A new page opens that lists the
SQL statements side by side, with the differences highlighted in each
statement.