SQL Performance Analyzer (SPA) allows you to evaluate a set of SQL statements against known workloads. This set of SQL statements with execution statistics and execution context is known as an SQL Tuning set. A single SQL Tuning set can be adjusted with updated SQL statements to test various evolutions of the same process. Additionally, you can use cursor cache and AWR snapshots to track performance. Using SQL TUNING SET enables you to:
- Store SQL text and auxiliary info in single persistent database objects.
- Capture Insert, update, delete, and select SQL statements in the SQL TUNING SET.
- Load and merge content from different data sources like AWR and cursor cache.
- Export SQL TUNING SET where SQL workload is captured and import into other systems.
- Reuse SQL workload as input source for other advisors like SQL Tuning Advisor and SQL Access Advisor.
The Views and package that relate to SPA are:
DBA_ADVISOR_TASKS – Info about SPA tasks created.
DBA_ADVISOR_EXECUTIONS – info about SPA tasks executed.
DBA_ADVISOR_FINDINGS – info about SPA finding, generate the following reports:
- Performance regressions problems.
- Changing structure of execution plan.
- Errors like non-existence of objects.
- Info messages.
DBA_ADVISOR_SQLPLANS – list of execution plans.
DBA_ADVISOR_SQLSTATS – list of SQWL compilations and execution statistics.
V$ADVISOR_PROGRESS – displays operation progress of SPA.
Functions
DBMS_SQLPA .CREATE_ANALYSIS_TASK – This function create analysis tasks for single SQL statements from SQL text, AWR, or cursor cache. Also create analysis task from SQL Tuning set.
DBMS_SQLPA .EXECUTE_ANALYSIS_TASK – This function executes defined analysis tasks.
DBMS_SQLPA .REPORT_ANALYSIS_TASK – This function displays results of executed tasks.
Steps in Performing Performance Analysis:
- Capture SQL workload to analyze and store it in a SQL tuning set.
- If using test system it should be as close to production as possible and transfer SQL Tuning Set.
- On test system create SPA task
- Build pre-change SQL trails by executing the SQL statements store in the SQL tuning set.
- Perform the system change.
- Build post-change SQL trial by re-executing the SQL statements in SQL tuning set on the post-change test system.
- Compare and analyze the pre-change and post-change versions of performance data and generate a report to identify the SLQ statements that have improved, remained unchanged, or regressed after system change.
- Tune any regressed SQL statements that are identified.
Larry Catt
OCP