DBA's New Best Friend: Oracle Database 10g and 11g SQL Performance Analyzer
DBA's New Best Friend: Oracle Database 10g and 11g SQL Performance Analyzer
Oracle 11g Real Application Testing: Avoiding Performance Regressions with SQL Performance Analyzer
Khaled Yagoub, Pete Belknap, Benoit Dageville, Karl Dias Database Manageability Group
Presentation Outline
SQL Performance Analyzer Overview
Common Usage Scenarios Workflow Phases
<Insert Picture Here>
Q/A
Helps users predict the impact of system changes on SQL workload response time Builds different versions of SQL workload performance (i.e., SQL execution plans and statistics)
Analysis Report
Integrated with SQL tuning set, SQL plan baselines, and SQL tuning advisor to form an End-toend solution
Transport STS
(6)
Reiterate
No
Done?
Yes
SQL Text, bind variables, parsing schema Execution plans and run-time statistics Number of executions
STS can be built from AWR, Cursor Cache, user workload and existing STS
Incremental Capture
SQL Tuning Set Production Database
Incremental capture used to populate STS from cursor cache over a time period
Negligible performance overhead (<2 %) Filtering and ranking capabilities filters out undesirable SQL
Cursor Cache
Export/Import
Test system should resemble production (stats ) Copy SQL tuning set to staging table (pack) Transport staging table to test system (datapump, db link, etc.) Copy SQL tuning set from staging table (unpack)
Test Execute
DDL skipped
Only query part of DML is executed Customizable global and per-SQL time limit to handle long running/run-away SQL Option to do Explain Plan only analysis Remote test-execute using database link (on 10.2 and up)
SQL Performance Analyzer
Test Execute
Manually implement the planned change Database upgrade, patches Optimizer statistics refresh Schema changes Database parameter changes Validate tuning actions, e.g., SQL Profile creation, Partitioning, etc. Hardware changes, e.g., Enabling direct IO, File System to ASM conversion, etc.
Re-execute SQL after change Gathers new SQL execution plans and run-time statistics (SQL Trial)
Analysis Report
Fix regressed SQL using SQL Tuning Advisor or SQL Plan Baselines
3 2
1 4
Step 6: Reiterate
Regression Remediation
Step 6: Reiterate
Report before using Plan Baselines
Step 6: Reiterate
Report after using Plan Baselines
Change Accepted
No Regressions after SPM fix
Parameter Changes
SPA Report
Parameter Changes
SQL Tuning Advisor Recommendations
Parameter Changes
SPA Report After Profiles Implemented
Change Accepted
-- create an analysis task Var tname varchar2(30); exec :tname := dbms_sqlpa.create_analysis_task(sqlset_name => my_sts task_name => my_task);
'comparison_metric', 'buffer_gets');
exec dbms_sqlpa.execute_analysis_task(task_name => :tname, execution_type=>'compare performance');
SQL Statements Sorted by their Absolute Value of Change Impact on the Workload ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | | Impact on | Metric | Metric | Impact | % Workload | % Workload | Plan | | object_id | sql_id | Workload | Before | After | on SQL | Before | After | Change | --------------------------------------------------------------------------------------------------------| 26 | 8answpy3djcj5 | 61.48% | 67 | 7 | 89.55% | 68.65% | 14.11% | y | | 29 | gcfysssf6hykh | -4.1% | 3 | 7 | -133.33% | 3.07% | 14.11% | y | | 30 | 8yyjua0yhcc92 | -4.1% | 3 | 7 | -133.33% | 3.07% | 14.11% | y | | 32 | 0782mpfq27aq5 | -4.1% | 3 | 7 | -133.33% | 3.07% | 14.11% | y | ---------------------------------------------------------------------------------------------------------
Summary
Enables identification of SQL performance changes (e.g., regressions) before end-users can be impacted Helps with any change that impacts SQL execution plans (e.g., DB upgrades, Optimizer statistics refresh, schema changes, etc.) Automates SQL performance tracking of hundreds of thousands of SQL statements impossible to do manually Prevents side effects to database content when executing SQL. Keeps history of all experiments performed on SQL workloads. Integrated with SQL Tuning Advisor and SQL Plan Baselines for regression remediation GUI provides predefined workflows for Database upgrades and parameter changes
Partitioning Advisor
Verify partition recommendations
Database Replay
Replays real database workload on test system Assess impact of change on workload throughput Captures workloads and replays it with production context including concurrency, synchronization & dependencies
What Purpose?
How it works?
When to use?
Comprehensive testing of all sub-systems of the database server using real production workload