drop table tab_big;
drop table tab_small;
create table tab_big as select * from dba_objects where rownum<=30000;
create table tab_small as select * from dba_objects where rownum<=10;
set autotrace traceonly
set linesize 1000
set timing on
select count(*) from tab_big,tab_small ;
drop table tab_small;
create table tab_big as select * from dba_objects where rownum<=30000;
create table tab_small as select * from dba_objects where rownum<=10;
set autotrace traceonly
set linesize 1000
set timing on
select count(*) from tab_big,tab_small ;
select count(*) from tab_small,tab_big ;
---查看执行计划,以上实验发现性能是一样的,
---NONONO,其实任何谣言,都是有一定的影子的。下面的语句,比较一下性能。
select /*+rule*/ count(*) from tab_big,tab_small ;
select /*+rule*/ count(*) from tab_small,tab_big ;
--看明白了,显然上一条性能好于下一条,谣言也不是真的无中生有!
结论:原来表连接顺序的说法早就过时了,那是基于规则的时代,现在我们是基于代价的,Oracle的RBO已经被淘汰,在CBO中表连接顺序前后在性能上已经相同了。