1. 首页
  2. 数据库
  3. Oracle
  4. 分页查询-big.data.analytics.with.spark

分页查询-big.data.analytics.with.spark

上传者: 2024-07-07 03:47:25上传 PDF文件 31.31MB 热度 10次
7.5、分页查询select * from (select rownum no,e.* from (select * from emp order by sal desc) e where rownum<=5 ) where no>=3; select * from (select rownum no,e.* from (select * from emp order by sal desc) e) where no>=3 and no<=5; 7.6、exists 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,反之如果外层的主查询记录较少,子查询中的表大,又有索引时使用exists。其实我们区分in和exists主要是造成了驱动顺序的改变(这是性能变化的关键),如果是exists,那么以外层表为驱动表,先被访问,如果是IN,那么先执行子查询,所以我们会以驱动表的快速返回为目标,那么就会考虑到索引及结果集的关系了另外IN是不对NULL进行处理
用户评论