SQL statements are stored in the SQL Repository for use in an Index Impact Analysis, and an Index Usage Analysis.
To add SQL statements
Click .
If no SQL exists in the SQL Repository Add SQL wizard appears automatically. Otherwise, click .
Select SQL | Add SQL or Add SQL from SQL Scanner.
Use the following pages in the Add SQL wizard has pages to select the options for saving the SQL statement to the SQL Repository.
The SQL syntax is checked and the access plan retrieved before adding a new node to the SQL tree view with the SQL name. Each SQL statement added to the SQL Repository contains an access plan, SQL classification type (Simple, Complex or Problematic) and the current connection information (login name, database alias, and schema). The access plan stored with the SQL statement is important as it indicates the current performance of the SQL.
SQL statements can also be added to the SQL Repository from other modules.
The General tab of the Add SQL wizard is used to name the SQL statement and to select the folder where you want the SQL statement saved.
|
Item |
Description |
|---|---|
|
Name |
Enter the name for the SQL to be saved in the SQL Repository. |
|
Description |
Enter the description for the SQL. |
|
Last modified |
Displays the last modified date and time. |
|
Login name |
Displays the connected login name. |
|
Database alias |
Displays the connected database alias. |
|
Schema |
Displays the connected schema. |
|
Save SQL to location |
Displays the tree location in which the SQL will be saved. In the bottom pane, select the folder where you want to save the SQL. To create a new folder, click |
The SQL Information page of the Add SQL wizard is where you can enter the SQL text and view information about the SQL statement, such as the access plans and temp table DDL.
Enter the SQL text.
The SQL Information pane has buttons at the top of it to select whether to display the access plan graph, access plan tree, Information (the classification of the SQL), and the DDL for creating any temporary tables used by the SQL statement. If the button is enabled, there is information on that page. If the button is , then no information is available for that SQL statement.
Checks the SQL syntax using the current database connection and retrieves the access plan, SQL type classification, and other information relating to the SQL statement.
If you feel the access plan stored with the SQL statement in the SQL Repository does not represent the current performance due to database changes, you can retrieve the current access plan from the database.
To retrieve the current access plan
From the SQL Repository window, select the SQL.
Select SQL | Refresh Plan or right-click the SQL statement in the tree view and select Refresh Plan
In the Refresh Plan window the original access plan is displayed on the left pane while the newly retrieved access plan is displayed on the right pane for comparison. You can view and analyze the newly retrieved access plan and SQL classification before saving the new access plan with the SQL statement.
Click Save to replace the original access plan with the newly retrieved one.