讨论Oracle文档学习经验

数据库 Oracle
这里介绍在Oracle文档上说:对于RBO来说,以from 子句中从右到左的顺序选择驱动表,即最右边的表为第一个驱动表。

Oracle有很多值得学习的地方,这里我们主要介绍Oracle文档,包括介绍RBO优化器等方面。在Oracle文档上说:对于RBO来说,以from 子句中从右到左的顺序选择驱动表,即最右边的表为第一个驱动表,这是其英文原文:All things being equal RBO chooses the driving order by taking the tables in the FROM clause RIGHT to LEFT。

不过,在我做的测试中,从来也没有验证过这种说法是正确的。我认为,即使在RBO中,也是有一套规则来决定使用哪种连接类型和哪个表作为驱动表,在选择时肯定会考虑当前索引的情况,还可能会考虑where 中的限制条件,但是肯定是与where中限制条件的位置无关。

如果我创建3个表:

  1. create table A(col1 number(4,0),col2 number(4,0), col4 char(30));  
  2. create table B(col1 number(4,0),col3 number(4,0), name_b char(30));  
  3. create table C(col2 number(4,0),col3 number(4,0), name_c char(30));  
  4. create index inx_col12A on a(col1,col2); 

执行查询:

  1. select A.col4  
  2. from B, A, C  
  3. where B.col3 = 10 
  4. and A.col1 = B.col1  
  5. and A.col2 = C.col2  
  6. and C.col3 = 5;  
  7. Execution Plan 

通过上面的这些例子,使我对Oracle文档上的” All things being equal RBO chooses the driving order by taking the tables in the FROM clause RIGHT to LEFT”这句话持怀疑态度。此时,我也不能使用hints来强制优化器使用nested loop,如果使用了hints,这样就自动使用CBO优化器,而不是RBO优化器了。

【编辑推荐】

  1. 如何了解Oracle生成执行计划
  2. 详细谈论Oracle表连接
  3. 分析Oracle索引扫描四大类
  4. 高手闲谈Oracle索引扫描
  5. 快速了解Oracle哈希连接
责任编辑:佚名 来源: 博客园
相关推荐

2009-11-17 10:40:45

2011-09-09 09:50:40

Oracle

2009-11-19 14:34:23

Oracle Exis

2009-07-10 15:10:02

Java Swing经

2009-11-20 15:19:29

Oracle Agil

2009-11-17 15:59:25

Oracle物化视图

2009-12-16 14:32:14

Linux Mint系

2010-05-04 18:14:50

Oracle 性能工具

2009-11-17 13:06:57

Oracle Free

2009-11-20 13:29:59

Oracle数据库恢复

2010-04-23 09:13:08

Oracle In-M

2009-12-18 14:23:22

Fedora进程管理

2009-12-29 12:50:24

Ubuntu root

2010-04-02 12:51:14

Oracle安装

2010-04-12 12:55:24

Oracle 安装经验

2010-04-28 17:29:07

Oracle字符集

2009-12-30 16:19:33

2009-07-14 17:01:24

JDBC基础

2009-09-07 17:09:45

Linq To Sql

2009-09-08 15:27:08

Linq Select
点赞
收藏

51CTO技术栈公众号