oracle分页

1)rownum分页(由oracle分配)慢十倍

    1.(select a1.*,rownum rn from (select * from emp) a1 where rownum<=10);

    2.select * from (select a1.*,rownum rn from (select * from emp) a1 where rownum<=10) where rn>=6;

    3.select * from (select a1.*,rownum rn from (select name,address from emp) a1 where rownum<=10) where rn>=6;//只需修改最里层字段即可限制

2)ROWID来分最快!

select * from t_xiaoxi where ROWID in (select rid from(select     rownum rn,rid from(select rowid rid ,cid from t_xiaoxi order by cid desc) where rownum<1000) where rn>500) order by cid desc;


3)函数(over)慢100倍

你可能感兴趣的:(oracle分页)