Oracle® Database Real Application Testing User's Guide 11g Release 2 (11.2) Part Number E12254-02 |
|
|
View PDF |
Once you have captured a SQL workload that you want to analyze into a SQL tuning set, you can run SQL Performance Analyzer to analyze the effects of a system change on SQL performance. To run SQL Performance Analyzer, you must first create a SQL Performance Analyzer task. A task is a container that encapsulates all of the data about a complete SQL Performance Analyzer analysis. A SQL Performance Analyzer analysis comprises of at least two SQL trials and a comparison. A SQL trial captures the execution performance of a SQL tuning set under specific environmental conditions and can be generated automatically using SQL Performance Analyzer by one of the following methods:
Test executing SQL statements
Generating execution plans for SQL statements
Referring to execution statistics and plans captured in a SQL tuning set
When creating a SQL Performance Analyzer task, you will need to select a SQL tuning set as its input source. The SQL tuning set will be used as the source for test executing or generating execution plans for SQL trials. Thus, performance differences between trials are caused by environmental differences. For more information, see "Creating a SQL Performance Analyzer Task".
This chapter described how to create a SQL Performance Analyzer task and contains the following topics:
Note:
The primary interface for running SQL Performance Analyzer is Oracle Enterprise Manager. If for some reason Oracle Enterprise Manager is unavailable, you can run SQL Performance Analyzer using theDBMS_SQLPA
PL/SQL package.Tip:
Before running SQL Performance Analyzer, capture the SQL workload to be used in the performance analysis into a SQL tuning set on the production system, then transport it to the test system where the performance analysis will be performed, as described in "Capturing the SQL Workload".There are 5 types of workflow available in Oracle Enterprise Manager for creating a SQL Performance Analyzer task:
Upgrade from 9i or 10.1
Use the upgrade from 9i or 10.1 workflow to test a database upgrade from Oracle9i Database or Oracle Database 10g Release 1 to Oracle Database 10g Release 2 and newer releases, as described in "Upgrading from Oracle9i Database and Oracle Database 10g Release 1".
Upgrade from 10.2 or 11g
Use the upgrade from 10.2 or 11g workflow to test a database upgrade from Oracle Database 10g Release 2 or Oracle Database 11g to a later release, as described in "Upgrading from Oracle Database 10g Release 2 and Newer Releases".
Parameter Change
Use the parameter change workflow to determine how a database initialization parameter change will affect SQL performance, as described in "Using the Parameter Change Workflow".
Exadata Simulation
Use the Exadata simulation workflow to simulate how using Oracle Exadata will affect SQL performance, as described in "Using the Exadata Simulation Workflow".
Guided workflow
Use the guided workflow to compare SQL performance for all other types of system changes, as described in "Using the Guided Workflow".
The parameter change workflow enables you to test the performance effect on a SQL workload when you change the value of a single environment initialization parameter. For example, you can compare SQL performance when the sort area size is increased from 1 MB to 2 MB.
After you select a SQL tuning set and a comparison metric, SQL Performance Analyzer creates a task and performs a trial with the initialization parameter set to the original value. SQL Performance Analyzer then performs a second trial with the parameter set to the changed value by issuing an ALTER SESSION
statement. The impact of the change is thus contained locally to the testing session. Any regression or change in performance is reported in a system-generated SQL Performance Analyzer report.
Note:
To create an analysis task for other types of system changes, use the guided workflow instead, as described in "Using the Guided Workflow".To use the SQL Performance Analyzer parameter change workflow:
On the Software and Support page, under Real Application Testing, click SQL Performance Analyzer.
The SQL Performance Analyzer page appears.
Under SQL Performance Analyzer Workflows, click Parameter Change.
The Parameter Change page appears.
In the Task Name field, enter the name of the task.
In the SQL Tuning Set field, enter the name of the SQL tuning set that contains the SQL workload to be analyzed.
Alternatively, click the search icon to search for a SQL tuning set using the Search and Select: SQL Tuning Set window.
The selected SQL tuning set now appears in the SQL Tuning Set field.
In the Description field, optionally enter a description of the task.
In the Creation Method list, determine how the SQL trial is created and what contents are generated by performing one of the following actions:
Select Execute SQLs.
The SQL trial generates both execution plans and statistics for each SQL statement in the SQL tuning set by actually running the SQL statements.
Select Generate Plans.
The SQL trial invokes the optimizer to create execution plans only without actually running the SQL statements.
In the Per-SQL Time Limit list, determine the time limit for SQL execution during the trial by performing one of the following actions:
Select 5 minutes.
The execution will run each SQL statement in the SQL tuning set up to 5 minutes and gather performance data.
Select Unlimited.
The execution will run each SQL statement in the SQL tuning set to completion and gather performance data. Collecting execution statistics provides greater accuracy in the performance analysis but takes a longer time. Using this setting is not recommended because the task may be stalled by one SQL statement for a prolonged time period.
Select Customize and enter the specified number of seconds, minutes, or hours.
In the Parameter Change section, complete the following steps:
In the Parameter Name field, enter the name of the initialization parameter whose value you want to modify, or click the Search icon to select an initialization parameter using the Search and Select: Initialization Parameters window.
In the Base Value field, enter the current value of the initialization parameter.
In the Changed Value field, enter the new value of the initialization parameter.
In the Comparison Metric list, select the comparison metric to use for the analysis:
If you selected Generate Plans in Step 6, then select Optimizer Cost.
If you selected Execute SQLs in Step 6, then select one of the following options:
Elapsed Time
CPU Time
User I/O Time
Buffer Gets
Physical I/O
Optimizer Cost
I/O Interconnect Bytes
To perform the comparison analysis by using more than one comparison metric, perform separate comparison analyses by repeating this procedure using different metrics.
In the Schedule section:
In the Time Zone list, select your time zone code.
Select Immediately to start the task now, or Later to schedule the task to start at a time specified using the Date and Time fields.
Click Submit.
The SQL Performance Analyzer page appears.
In the SQL Performance Analyzer Tasks section, the status of this task is displayed. To refresh the status icon, click Refresh. After the task completes, the Status field changes to Completed.
In the SQL Performance Analyzer Tasks section, select the task and click the link in the Name column.
The SQL Performance Analyzer Task page appears.
This page contains the following sections:
SQL Tuning Set
This section summarizes information about the SQL tuning set, including its name, owner, description, and the number of SQL statements it contains.
SQL Trials
This section includes a table that lists the SQL trials used in the SQL Performance Analyzer task.
SQL Trial Comparisons
This section contains a table that lists the results of the SQL trial comparisons
Click the icon in the Comparison Report column.
The SQL Performance Analyzer Task Result page appears.
Review the results of the performance analysis, as described in "Reviewing the SQL Performance Analyzer Report Using Oracle Enterprise Manager".
In cases when regression are identified, click the icon in the SQL Tune Report column to view a SQL tuning report.
The Exadata simulation workflow enables you to simulate the effects of an Exadata Storage Server installation on the performance of a SQL workload.
Oracle Exadata provides extremely large I/O bandwidth coupled with a capability to offload SQL processing from the database to storage. This allows Oracle Database to significantly reduce the volume of data sent through the I/O interconnect, while at the same time offloading CPU resources to the Exadata storage cells.
SQL Performance Analyzer can analyze the effectiveness of Exadata SQL offload processing by simulating an Exadata Storage Server installation and measuring the reduction in I/O interconnect usage for the SQL workload.
Running the Exadata simulation does not require any hardware or configuration changes to your system. After you select a SQL tuning set, SQL Performance Analyzer creates a task and performs an initial trial with the Exadata Storage Server simulation disabled. SQL Performance Analyzer then performs a second trial with the Exadata Storage Server simulation enabled. SQL Performance Analyzer then compares the two trials using the I/O Interconnect Bytes comparison metric and generates a SQL Performance Analyzer report, which estimates the amount of data that would not need to be sent from the Exadata storage cells to the database if Oracle Exadata is being used. In both SQL trials, the SQL statements are executed to completion and I/O interconnect bytes measurements are taken are the actual and simulated Exadata values for the first and second trials, respectively. The measured change in I/O interconnect bytes provides a good estimate of how much filtering can be performed in the Exadata storage cells and, in turn, the amount of CPU that normally would be used to process this data, but now can be offloaded from the database.
Note:
Using the Exadata simulation will not result in any plan changes. Execution plans do not change in an Exadata Storage Server installation because the simulation focuses on measuring the improvement in I/O interconnect usage. Moreover, I/O interconnect bytes will not increase, except when data compression is used (see next note), because Oracle Exadata will only decrease the amount of data sent to the database.Note:
Because I/O interconnect bytes is the only metric used to measure the performance change impact of using an Exadata Storage Server installation, it will not work properly if Oracle Exadata is used with data compression. Since Exadata storage cells also decompress data, the I/O interconnect bytes with Oracle Exadata (or the second SQL trial) of a SQL statement may be greater than the I/O interconnect bytes without Oracle Exadata (or the first SQL trial) where the data is compressed. This comparison will be misleading because the SQL statement will be reported as a regression; when in fact, it is not.Note:
The Exadata simulation workflow is used to simulate an Exadata Storage Server installation on non-Exadata hardware. To test changes on Exadata hardware, use the standard SQL Performance Analyzer workflows.To use the SQL Performance Analyzer Exadata simulation workflow:
On the Software and Support page, under Real Application Testing, click SQL Performance Analyzer.
The SQL Performance Analyzer page appears.
Under SQL Performance Analyzer Workflows, click Exadata Simulation.
The Exadata Simulation page appears.
In the Task Name field, enter the name of the task.
In the SQL Tuning Set field, enter the name of the SQL tuning set that contains the SQL workload to be analyzed.
Alternatively, click the search icon to search for a SQL tuning set using the Search and Select: SQL Tuning Set window.
The selected SQL tuning set now appears in the SQL Tuning Set field.
In the Description field, optionally enter a description of the task.
In the Per-SQL Time Limit list, determine the time limit for SQL execution during the trial by performing one of the following actions:
Select 5 minutes.
The execution will run each SQL statement in the SQL tuning set up to 5 minutes and gather performance data.
Select Unlimited.
The execution will run each SQL statement in the SQL tuning set to completion and gather performance data. Collecting execution statistics provides greater accuracy in the performance analysis but takes a longer time. Using this setting is not recommended because the task may be stalled by one SQL statement for a prolonged time period.
Select Customize and enter the specified number of seconds, minutes, or hours.
In the Schedule section:
In the Time Zone list, select your time zone code.
Select Immediately to start the task now, or Later to schedule the task to start at a time specified using the Date and Time fields.
Click Submit.
The SQL Performance Analyzer page appears.
In the SQL Performance Analyzer Tasks section, the status of this task is displayed. To refresh the status icon, click Refresh. After the task completes, the Status field changes to Completed.
In the SQL Performance Analyzer Tasks section, select the task and click the link in the Name column.
The SQL Performance Analyzer Task page appears.
This page contains the following sections:
SQL Tuning Set
This section summarizes information about the SQL tuning set, including its name, owner, description, and the number of SQL statements it contains.
SQL Trials
This section includes a table that lists the SQL trials used in the SQL Performance Analyzer task.
SQL Trial Comparisons
This section contains a table that lists the results of the SQL trial comparisons
Click the icon in the Comparison Report column.
The SQL Performance Analyzer Task Result page appears.
Review the results of the performance analysis, as described in "Reviewing the SQL Performance Analyzer Report Using Oracle Enterprise Manager".
Any SQL performance improvement with the Exadata simulation between the first and second trials is captured in the report. In general, you can expect a greater impact if the SQL workload contains queries that scan a large number of rows or a small subset of table columns. Conversely, a SQL workload that queries indexed tables or tables with fewer rows will result in a lesser impact from the Exadata simulation.
The guided workflow enables you to test the performance effect of any types of system changes on a SQL workload, as listed in "SQL Performance Analyzer".
Note:
To create an analysis task to test database initialization parameter changes, use the simplified parameter change workflow instead, as described in "Using the Parameter Change Workflow".To use the SQL Performance Analyzer task guided workflow:
On the Software and Support page, under Real Application Testing, click SQL Performance Analyzer.
The SQL Performance Analyzer page appears.
Under SQL Performance Analyzer Workflows, click Guided Workflow.
The Guided Workflow page appears.
The guided workflow enables you to test the performance effect on a SQL workload when you perform any type of system changes, as described in "SQL Performance Analyzer".
This page lists the required steps in the SQL Performance Analyzer task in sequential order. Each step must be completed in the order displayed before the next step can begin.
On the Guided Workflow page, click the Execute icon for the Step 1: Create SQL Performance Analyzer Task based on SQL Tuning Set.
The Create SQL Performance Analyzer Task page appears.
In the Name field, enter the name of the task.
In the Description field, optionally enter a description of the task.
Under SQL Tuning Set, in the Name field, enter the name the SQL tuning set that contains the SQL workload to be analyzed.
Alternatively, click the search icon to select a SQL tuning set from the Search and Select: SQL Tuning Set window.
Click Create.
The Guided Workflow page appears.
The Status icon of this step has changed to a check mark and the Execute icon for the next step is now enabled.
Once the analysis task is created, you can build the pre-change performance data by executing the SQL statements stored in the SQL tuning set, as described in Chapter 9, "Creating a Pre-Change SQL Trial".
This section describes how to create a SQL Performance Analyzer task by using the DBMS_SQLPA.CREATE_ANALYSIS_TASK
function. A task is a database container for SQL Performance Analyzer execution inputs and results.
Tip:
Before proceeding, capture the SQL workload to be used in the performance analysis into a SQL tuning set on the production system, then transport it to the test system where the performance analysis will be performed, as described in "Capturing the SQL Workload".Call the CREATE_ANALYSIS_TASK
function to prepare the analysis of a SQL tuning set using the following parameters:
Set task_name
to specify an optional name for the SQL Performance Analyzer task.
Set sqlset_name
to the name of the SQL tuning set.
Set sqlset_owner
to the owner of the SQL tuning set. The default is the current schema owner.
Set basic_filter
to the SQL predicate used to filter the SQL from the SQL tuning set.
Set order_by
to specify the order in which the SQL statements will be executed.
You can use this parameter to ensure that the more important SQL statements will be processed and not skipped if the time limit is reached.
Set top_sql
to consider only the top number of SQL statements after filtering and ranking.
The following example illustrates a function call:
VARIABLE t_name VARCHAR2(100); EXEC :t_name := DBMS_SQLPA.CREATE_ANALYSIS_TASK(sqlset_name => 'my_sts', - task_name => 'my_spa_task');
Once the analysis task is created, you can build the pre-change performance data by executing the SQL statements stored in the SQL tuning set, as described in Chapter 9, "Creating a Pre-Change SQL Trial".
See Also:
Oracle Database PL/SQL Packages and Types Reference to learn more about the DBMS_SQLPA.CREATE_ANALYSIS_TASK
function
This section describes how to run the Oracle Exadata simulation using APIs. For information about how SQL Performance Analyzer simulates the effects of an Exadata Storage Server installation on the performance of a SQL workload, see "Using the Exadata Simulation Workflow".
To enable Exadata simulation for an analysis task, call the SET_ANALYSIS_TASK_PARAMETER
procedure before creating the post-change SQL trial, as shown in the following example:
EXEC DBMS_SQLPA.SET_ANALYSIS_TASK_PARAMETER(task_name => 'my_spa_task', - parameter => 'CELL_SIMULATION_ENABLED', - value => 'TRUE');
This will enable Exadata simulation when you create the post-change SQL trial, which can then be compared to the pre-change SQL trial that was created with Exadata simulation disabled.
Alternatively, you can run the Exadata simulation using the tcellsim.sql
script:
At the SQL prompt, enter:
@$ORACLE_HOME/rdbms/admin/tcellsim.sql
Enter the name and owner of the SQL tuning set to use:
Enter value for sts_name: MY_STS Enter value for sts_owner: IMMCHAN
The script then runs the following four steps automatically:
Creates a SQL Performance Analyzer task
Test executes SQL statements with Exadata simulation disabled
Test executes SQL statements with Exadata simulation enabled
Compares performance and generates analysis report