Search:     Advanced search
Browse by category:
C/C++   |   Java   |   Oracle/Database   |   SAP   |   ASP .NET   |   Mainframe-DB2   |   Freshers

Q: What is the difference between Rule based optimization and Cost based optimization in Oracle SQL queries?

Add comment
Views: 571
Votes: 3
Comments: 1

Rule based optimizer or RBO uses a set of rules to determine the execution plan for a given query. For example if there is an index on one of the columns used in where clause, then RBO will always use the index. The biggest problem with RBO is that it does not take the distribution of data into consideration and hence sometimes ends up slowing down the query.
For example if a table has a column status that can have only 2 values Y or N. Now if there is an index on this column, then the index shall be used everytime a query uses status in the where clause. If such a query returns 50% of the table then use of the index slows down the query execution.

The Cost based optimizer or CBO uses statistics about the table, indexes and the data distribution in them to make better decisions. Using the previous example, if the status column has 90% Y and 10% N. If a query uses status='Y' the index shall not be used. On the otherhand If a query uses status='N' the index shall be used.

Showing: 1-1 of 1  
Comments

21 Mar, 2008   |   satya
yes u r good


Add comment

Others in this Category
document Q: Can a view be updated/inserted/deleted? If Yes under what conditions ?
document What is Normalization?
document What is UNIQUE KEY constraint?
document What is Filtered Index?
document Name 3 ways to get an accurate count of the number of records in a table?
document What is B-Tree?
document Q: What is CYCLE/NO CYCLE in a Sequence ?
document What are synonyms?
document Q: What are various constraints used in SQL?
document What is Service Broker?
» More articles



RSS