As you add SQL statements to the job on the Overview tab of the tuner, tuning-supported DML statements (SELECT, INSERT, DELETE, and UPDATE as well as MERGE on SQL Server 2008 and above) are parsed from the statements and added to the Overview tab in preparation for the tuning function execution.
Each tuning source statement is listed by Name, Schema, Text, Tables and Views. For SQL Server and Sybase platforms, there is also a Catalog column. Additionally, each statement will have Time and Analysis values that approximate how efficiently they execute on the specified data source.
In the Generated Cases area of the Overview tab of a tuning job, the Cost and Execution Statistics columns let you compare the relative efficiency of SQL statements or statement cases. While the explain plan Cost for a statement or case is calculated when you add SQL to a tuning job, the Elapsed Time and Execution Statistics (and Other Execution Statistics columns, if available) columns are not populated until you execute that statement or case.
If the Tuning Status Indicator indicates that a statement or case is ready to execute, you can execute one or more statements on the Overview tab. Alternatively, the Tuning Status Indicator may show that you have to correct the SQL or set bind variables before you can execute.
Once the tuning job has run, the Overview tab provides a series of cases, per statement, that you can select and modify based on your results.
In some cases, automatic case generation might be disabled (via the Preferences panel). If this is true, or if you have otherwise modified the Generated Cases table and can no longer generate a specific case, you can instead explicitly generate a case for specific statements.
To execute a tuning job
- Ensure you have registered and selected a data source. For more information, see Register data sources and Specify a data source.
- Ensure you are connected to the database by double clicking the database name in the Data Source Explorer.
- Click the tuning icon on the toolbar, or click File > New > Tuning Job.
- On the Overview tab, specify the SQL you want to tune:
- Modify the number of times to execute each statement in the Execute each generated case field at the top right of the tuner, as needed.
- Click the execution button [ ] on the right side of the case generation field.
- The tuning job runs, exacting and analyzing each statement and providing values in the appropriate columns.
To explicitly generate a case for a specific statement
- Ensure you are connected to the database by double clicking the database name in the Data Source Explorer.
- Click the Overview tab.
- In the Generated Cases area, right-click in the Name field of a statement or transformation case and select Generate Cases from the context menu, or click the Overview Run Job icon. The specified case is generated.
To view the generated cases for a specific statement
- In the Tuning Statements area, click the checkbox to the left of the tuning source statement name.
A check mark appears in the checkbox and the cases displayed in the Generated Cases area are filtered to display only those cases related to the selected source statement.