Oracle分页SQL优化
一、分页框架
1.正确的分页框架
select *
from (select * from (select a.*,rownum rn from (需要分页的SQL) a )
where rownum <=10)
where rn >=1;
2.错误的分页框架
select *
from (select t.* ,rownum rn from (需要分页的SQL) t )
where rn >=1
and rn <=10;
采用错误的分页框架,会带来严重的性能问题;
日积月累