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

 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
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

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

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 









Oracle cost-based optimizer

Don Burleson

Updated January 6, 2015

Oracle's cost-based SQL optimizer (cost based optimizer) is an extremely sophisticated component of Oracle that governs the execution for every Oracle query. The cost based optimizer has evolved into one of the world's most sophisticated software components, and it has the challenging job of evaluating any SQL statement and generating the "best" execution plan for the statement. Because the cost based optimizer determines the execution speed for every Oracle query, the Oracle professional must understand how the cost based optimizer is influenced by Oracle external issues, internal statistics, and data distribution.

There are two types of factors that influence the cost-based optimizer, those factors that are immutable (that we cannot change), and those for which we have some control.  The immutable factors in a SQL statement include basic issues such as the number of rows returned by the query.  But far and away, variable factors influence the costing decisions made by the optimizer:

  • Disk I/O speed - The cost of disk I/O is the single most important factor in SQL optimization.  Disk I/O is measured in thousandths of a second, an eternity for a database, and something that needs to be avoided whenever possible.
  • Available RAM - The DBA configures the Oracle instance RAM resources, and the optimizer will be severely limited if there is not enough RAM for hash joins (via pga_aggregate_target, sort_area_size and hash_area_size).
  • Object metadata - The DBA controls the quality of the metadata via the dbms_stats package.  This data includes the number of rows in a table, the distribution of values within a column and other critical information about the state of the tables and indexes. 
  • Server metadata - The DBA controls the gathering of server-side metadata via dbms_stats.gather_system_stats.  This measures CPU speed, single probe disk read speed (db file sequential reads) and multi-block reads (db file scattered reads).

Disk speed matters most!

If you forget to analyze server statistics with dbms_stats.gather_system_stats, Oracle uses a default disk I/O speed of ten milliseconds. Analyzing server statistics is one of the most important things that you can do to tune your SQL!

There are many other factors, but this gives you the general idea of how you can influence the costing decisions of the optimizer.

  • cost based optimizer parameters. We will start by reviewing the basic optimizer modes within the cost based optimizer and then drill down and examine specific parameters that influence the behavior of the cost based optimizer.   Using SQL Cost-based optimizer Parameters
  • cost based optimizer statistics. We will examine the importance of gathering proper cost based optimizer statistics with     dbms_stats and review techniques for ensuring that execution plans remain stable. We will also look   at techniques for migrating statistics between systems and examine how developers can optimize their SQL in a test environment and confidently migrate SQL into production without fear of changing execution plans.   Using Oracle cost-based optimizer schema statistics
  • Using histograms with the Oracle cost-based optimizer
  • Data clustering and SQL tuning
  • Hints and the cost based optimizer





    Oracle Training at Sea
    oracle dba poster

    Follow us on Twitter 
    Oracle performance tuning software 
    Oracle Linux poster


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

    All rights reserved by Burleson

    Oracle ® is the registered trademark of Oracle Corporation.