Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

Free Oracle Tips

HTML Text

 Home
 E-mail Us
 Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB   


 

 

 


 

 

 
 

Historical analysis of SQL execution plans

Oracle Tips by Burleson Consulting
January 9,  2009

 

SQL Plan history Analysis is not an easy chore.  As the world’s most robust and complex database, Oracle offers something for everyone, and it can be confusing to optimize Oracle because of the plethora of features.

One wonderful feature of Oracle is the ability to have SQL execution plans change when the characteristics of the underlying table changes.   For shops where a table is huge one day and small the next, of shops where column distribution vary wildly, dynamic SQL is a Godsend.

However, dynamic SQL changes are not so great for stable shops where there exists one, and only one optimal execution plan for any given SQL statement.

To learn more, see my notes on identifying your SQL philosophy.

Because SQL plans will change whenever we make changes to the instance, any SQL statement will have a history of execution plans.  Here are some common acts that will change execution plans:

  • Enabling dynamic sampling

  • Re-analyze the schema statistics (done automatically, starting in 10g)

  • Changing an optimizer parameter (optimizer_mode, optimizer_index_cost_adj)

  • Enabling parallelism

This execution plan history can be seen by running scripts against the STATSPACK (stats$sql_plan and stats$sql_plan_usage) or the AWR (dba_hist_sql_plan) tables. 

Once you have acquired the SQL_ID for a statement, you can use the built-in dbms_xplan.display_awr procedure to see all the different execution plans for the query.

The dbms_xplan.display_awr allows you to input only a SQL_ID, and Oracle will show you the of the explain plans for that SQL_ID, as recorded in the AWR. This simple query will show changes to SQL explain plan history, if you have purchased the extra-cost licenses for AWR.

  select * from TABLE(DBMS_XPLAN.DISPLAY_AWR('&sqlid'));

For more detailed scripts, and free STATSPACK script to monitor SQL execution patterns with details on historical SQL plan analysis, see my book “Oracle Tuning: The Definitive Reference”.

Oracle 11g has introduced a wealth of new tools to help us "freeze" optimal SQL execution plan, so that they do not change when the data changes, tools such as the 11g SQL Performance Analyzer which uses a scientific approach to run real-world workloads and only change the SQL execution plans when they are at least 3x faster.  For complete details, see the 11g New Features book.

Also, see these notes from the Oracle CBO group on SQL plan history analysis., where they coined the term "plan regression" for changes that result in a sub-optimal execution plan.  While Oracle 11g has tools for tracking explain plans, you can still choose manual methods, gathering changes to execution plans from STATSPACK or the extra-cost AWR tables.



 

 

  
 

 
 
 
 
Oracle performance tuning software
 
 

 

 
 
 
Oracle performance Tuning 10g reference poster
 
 
 
Oracle training in Linux commands
 
Oracle training Excel
 
Oracle training & performance tuning books
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright ? 1996 -  2012 

All rights reserved.

Oracle ? is the registered trademark of Oracle Corporation.