INEXISTS与NOT INNOT EXISTS 的优化原则小结
1. EXISTS的执行流程 select * from t1 where exists ( select null from t2 where y = x ) 可以理解为: 代码如下: for x in ( select * from t1 ) loop if ( exists ( select null from t2 where y = x.x ) then OUTPUT THE RECORD end if end loop 对于in 和 exists的性能区别: 如果子查询得出的结果集记录较少,主查询中的表较大且又有索引时应该用in,反之如果外层的主查询记录较少,子查询中的表大,又
下载地址
用户评论