一般情况下,在两表连接时,表记录条数较少的会被作为驱动表,根据每一个驱动表的记录,去匹配被驱动表的所有满足条件的数据。如果是这种扫描方式,那么这里问题就来了,,为什么说条数较少的表作为驱动表,效率就一定高呢?
下面实验:
先实验一般情况:
建表
create table a (id number,name char(8));
create table B (id number,name char(8));
插入数据
/*
begin
for i in 1..10 loop
insert into a values(i,to_char(round(dbms_random.value,8)*100000000));
end loop;
commit;
end;
*/
/*begin
for i in 1..1000 loop
insert into b values(i,to_char(round(dbms_random.value,8)*100000000));
e