oracle sql查询效率

* 开始循环。
* 1 ORACLE查询条件优先级是从右到左,因此应把过滤程度高的数据放在后面;
* 2.尽量少用*。
* 3. in 和exists:
1) select * from T1 where exists(select 1 from T2 where T1.a=T2.a) ;
2) select * from T1 where T1.a in (select T2.a from T2) ;
T1数据量小而T2数据量非常大时,T1<<T2 时,1) 的查询效率高。
T1数据量非常大而T2数据量小时,T1>>T2 时,2) 的查询效率高。

猜你喜欢

转载自cuityang.iteye.com/blog/2350903