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

 
 Home
 E-mail Us
 Oracle Articles
New 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  

Don Burleson Blog 


 

 

 


 

 

 
 

Oracle 12c adaptive optimization of SQL

Oracle Tips by Burleson Consulting

February 22, 2015

Question: 
What is the Oracle 12c adaptive optimization procedures that are being described on the web? 

Answer:  In a nutshell, Oracle 12c adaptive optimization is the ability of Oracle to learn from its mistakes. Whenever Oracle notices that he has miscalculated a cardinality estimate, he stores the "real" cardinality such that subsequent SQL executions till be faster then the initial execution. Also see my detailed notes on adaptive execution plans.

In a nutshell, the Oracle optimizer postpones the decision of what types of table join to use (e.g. hash join, nested loops join) until run-time, after the Oracle execution has had a chance to inspect the characteristics of the tables being joined.  This gets around the issue of staleness of CBO statistics and is analogous to the Oracle dynamic damping utility, first introduced in Oracle 10g.

NOTE:  Oracle dynamic sampling has been re-named to dynamic (or adaptive) statistics in 12c.

At run time, the Oracle optimizer begins a nested loops join, and buffers the data until it has a chance to see whether a hash join might be a faster join technique.  If so, Oracle will abandon the bested loops join and change it into a hash join, all during query execution.

This adaptive optimization approach acknowledges that it can be impossible for any software program to always guess cardinality correctly, and cardinality determines unimportant SQL optimization steps, such as table join order.

If  the optimizer notices that he came up with a sub-optimal SQL execution plan (i.e. wrong table join type), the optimizer will take action to correct the error, before fetching the data:

1 – Store the “real” stats in the dictionary (SYSAUX tablespace) as “adaptive statistics” (a..k.a. dynamic statistics)

2 - Take the change into consideration for later queries, using the “real” cardinality in lieu of the cardinality estimate.

3 – Note a new step called a “STATISTICS COLLECTOR” in a tkprof (SQL Trace).

4 - The resulting stats are cached as shared dynamic stats specific for the statement, including the bind values. This information can be used by any session using the same SQL query. 

Oracle notes that It is also possible to put adaptive join methods into reporting mode by setting the init.ora parameter optimizer_adaptive_reporting_only=true.

When optimizer_adaptive_reporting_only=true, the information needed to enable adaptive join methods is gathered, but no action is taken to change the execution plans.  This effectively turn-off dynamic statistics because the default value is optimizer_adaptive_reporting_only=false.

 

 
Get the Complete
Oracle SQL Tuning Information 

The landmark book "Advanced Oracle SQL Tuning  The Definitive Reference"  is filled with valuable information on Oracle SQL Tuning. This book includes scripts and tools to hypercharge Oracle 11g performance and you can buy it for 30% off directly from the publisher.

 

 

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 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster