Here's a clear side-by-side comparison of Rule-Based Optimizer (RBO) vs Cost-Based Optimizer (CBO) behavior in Oracle:
| Aspect |
Rule-Based Optimizer (RBO) |
Cost-Based Optimizer (CBO) |
| Decision Basis |
Uses predefined rules for execution plans |
Uses statistics (table, index, column) to estimate cost |
| Predicate Order Importance |
Yes – most selective predicate should come last |
No – predicate order in SQL is ignored |
| Join Order |
Follows fixed rules (e.g., nested loops) |
Reorders joins based on cost estimates |
| Index Selection |
Picks the first matching index based on rules |
Chooses index based on selectivity and cost |
| Optimization Mode |
Rule-based: no cost model involved |
Cost-based: uses cost = I/O + CPU + network estimations |
| Statistics Usage |
No statistics are used |
Relies heavily on table and column statistics |
| Histograms |
Not applicable |
Can use histograms to understand column data distribution |
| Hint Sensitivity |
Uses rule-based hints like `RULE`, `INDEX` |
Honors CBO hints like `ALL_ROWS`, `FIRST_ROWS(n)` |
| Deprecated? |
✅ Deprecated as of Oracle 10g |
✅ Default and recommended optimizer since Oracle 10g |
| Real-World Suitability |
Suitable for small, static systems |
Ideal for complex, dynamic workloads |