优化器(Optimizer)
优化器,是oracle的一个工具,或者说是oracle的一个功能。就像人的味觉和人的关系一样。通俗的讲,就是oracle在执行sql前对,判断一下改如何执行这条sql。
oracle的优化器分为两种:RBO(Rule-Based Optimizer 基于规则优化器)和CBO(Cost-Based Optimizer 基于成本优化器)。
Rule-Based Optimizer(基于规则优化器)
https://docs.oracle.com/cd/B10501_01/server.920/a96533/rbo.htm#38960
从10g开始,RBO已经被oracle废除。
通过RBO,优化器根据访问路径来选择执行计划的。按访问路径排名选择执行计划,显然,最优先的先选择是1.Row by Rowid(rowid定位行);反之15.full table scan (全表扫描)
以下是RBO的详细访问路径(共15级):
RBO Path 1: Single Row by Rowid
RBO Path 2: Single Row by Cluster Join
RBO Path 3: Single Row by Hash Cluster Key with Unique or Primary Key
RBO Path 4: Single Row by Unique or Primary Key
RBO Path 7: Indexed Cluster Key
RBO Path 9: Single-Column Indexes
RBO Path 10: Bounded Range Search on Indexed Columns
RBO Path 11: Unbounded Range Search on Indexed Columns
RBO Path 13: MAX or MIN of Indexed Column
RBO Path 14: ORDER BY on Indexed Column