Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, santhoshreddy.

Asked: November 30, 2016 - 6:01 am UTC

Last updated: February 06, 2019 - 1:53 am UTC

Version: 11g

Viewed 1000+ times

You Asked

Hi,

I am new to Performance tuning,Would you please explain what is RBO,CBO?

and Chris said...

RBO = rule based optimizer
CBO = cost based optimizer

The RBO follows a series of rules to decide which execution plan to use for a statement. This is long deprecated and you should not use it!

The CBO uses stats about your tables (number of rows, distinct values, nulls, etc.) to determine the best execution plan. It evaluates possible plans, assigns them a cost and chooses the one with that comes out with the lowest value.

You can read more about optimizer concepts at:

http://docs.oracle.com/database/121/TGSQL/tgsql_optcncpt.htm#TGSQL192

Rating

  (3 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

What is Stats

A reader, May 21, 2017 - 7:05 am UTC

you said
"The CBO uses stats about your tables (number of rows, distinct values, nulls, etc.)"
you mean Table Statisticks?if,Can we access them(Table Statistics) by using any queries.
Chris Saxon
May 25, 2017 - 3:18 pm UTC

This information is spread over a number of views, including:

*_tables
*_tab_statistics
*_tab_col_statistics
*_tab_histograms

Additional Statistics information

James Mulder, May 25, 2017 - 11:04 pm UTC

Chris:

Great information.

There's also Partition and Subpartition Statistics:
*_tab_partitions
*_part_col_statistics
*_tab_subpartitions
*_subpart_col_statistics

Also, the Density and Histogram Columns are critical to understanding and troubleshooting statistics.

I wrote a Stats Exploration query to help diagnose at-a-glance statistic issues. It's not perfect but it has helped me in a number of situations over the years. It includes the calculation for DENSITY for no histograms and for FREQUENCY histograms after much research via Tom Kyte, Jonathan Lewis and Wolfgang Breitling. If it is of interest to you feel free to reach out to me. I believe it would be a nice to share with the Oracle community.

James
PS - I have been working with Oracle Statistics since 2006.
Connor McDonald
May 26, 2017 - 1:09 am UTC

We'd certainly like to see it. Perhaps you could blog about it and put a link in here as a review.

A reader, February 06, 2019 - 1:25 am UTC

We got weird issue and not understanding how to solve it.
We developed a package and tested it in Dev and Test instances.It worked fine but when we migrated this code to prod we got performance issue it taking lot of time to give output.So we again moved it to test there it worked fine.It got issue with only production, what might be the issue, any suggestions on it?
Connor McDonald
February 06, 2019 - 1:53 am UTC

Production is different to Dev/Test.

For example:

select * from t

where 't' has 10 rows in Dev, and 10million rows in Prod will obviously run differently in each environment.

You need to explore what the differences are between the environments:

- data sizes
- data distribution
- statistics

More to Explore

Performance

Get all the information about database performance in the Database Performance guide.