1.数据脚本
drop table test1 ;
create table test1 as
select * from (select d.*,rownum as rn
from dba_objects d
where d.owner not in ('SYS','SYSTEM','PUBLIC'))
where mod(rn,20)=0;
alter table test1 add constraint pk_test1 primary key (object_id);
2.SQL优化
2.1 优化前
select t1.*
from test1 t1
where t1.object_id in (select t2.object_id
from test2 t2