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 








SQL tuning with histograms

Oracle Tips by Burleson Consulting


I just returned from a large Oracle conference and I spoke with several people about an interesting trick to improve Oracle?s cost-based SQL optimizer (the CBO) by fixing Oracle cardinality errors for inter-table join baggage.  See my other notes on SQL tuning with histograms.

The Oracle CBO needs to be able to accurately estimate the final number of rows returned by each step of the query.  When an SQL query has a complex WHERE clause it can be very difficult to estimate the size of the intermediate result sets, especially when the WHERE clause transforms column values with mathematical functions.


This is one reason that the ORDERED hint is so popular, but it has been shown that having liberal column histograms on the table columns can often aid the optimizer in making better execution plans.


In sum, histograms are not just for non-unique column values that are unevenly distributed (skewed), and several noted DBA?s have suggested that more liberal use of histograms will aid the CBO is making better decisions.  The dbms_stats ?auto? feature detects and builds column histograms, but it has the shortcoming of being too conservative in some cases. 


Savvy DBA?s are now experimenting with broad-brush histograms, for all indexes columns.  I first heard of this technique from Jeff Maresh (noted data warehouse consultant), who told me that he has taken to creating 10-bucket histograms for all data warehouse table columns.  I heard this advice again at the IOUG conference from Arup Nanda (noted author and DBA of the year) and from Mike Ault.


They are abandoning the use of the ?auto? option and manually creating 20-bucket histograms across-the-board, and they claim that it can make a huge difference for databases with lots of multi-table joins in he SQL.


I?ve not tried this technique yet, but when three experts make the assertion, I believe that there may be something to the new technique.  The only downside, of course, is the time required to gather the column histograms and a small amount of additional storage in the data dictionary.


I go into deeply into the issue of index join cardinality on my new book "Oracle Tuning: The Definitive Reference"


If you like Oracle tuning, see the book "Oracle Tuning: The Definitive Reference", with 950 pages of tuning tips and scripts. 

You can buy it direct from the publisher for 30%-off and get instant access to the code depot of Oracle tuning scripts.



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

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational