Oracle的分页方法
2016-05-01 00:51
651 查看
- 1.根据ROWID来分<!--more-->
- select * from t_xiaoxi where rowid in(select rid from (select rownum rn,ridfrom(select rowid rid,cid from
- t_xiaoxi order by cid desc) where rownum<10000) where rn>9980)order by cid desc;
- select * from t_xiaoxi where rowid in(select rid from (select rownum rn,ridfrom(select rowid rid,cid from
- t_xiaoxi order by cid desc) where rownum<10000) where rn>9980)order by cid desc;
- 执行时间0.03秒
- 2.按分析函数来分
- select * from (select t.*,row_number() over(order by cid desc) rk from t_xiaoxit) where rk<10000 and rk>9980;
- select * from (select t.*,row_number() over(order by cid desc) rk from t_xiaoxit) where rk<10000 and rk>9980;
- 执行时间1.01秒
- 3.按ROWNUM来分
- select * from(select t.*,rownum rn from(select * from t_xiaoxi order by ciddesc) t where rownum<10000) where
- rn>9980;
- select * from(select t.*,rownum rn from(select * < 24a2b /span>from t_xiaoxi order by ciddesc) t where rownum<10000) where
- rn>9980;
- 执行时间0.1秒
- 其中t_xiaoxi为表名称,cid为表的关键字段,取按CID降序排序后的第9981-9999条记录,t_xiaoxi表有70000多条记录
- 个人感觉1的效率最好,3次之,2最差
相关文章推荐
- 分页显示问题的解决方法(jsp,sqlserver,mysql,oracle)
- Oracle中实现分页的方法
- Hibernate4重写Oracle分页方法,使用Oracle12c新分页语句
- oracle几种分页方法效率比较。
- 【SQL】Oracle分页查询的三种方法
- Oracle中的SQL分页查询原理和方法详解
- 在javaBean中实现对Oracle的分页方法
- 在ORACLE大数据量下的分页解决方法。
- oracle分页显示方法 rownum的使用
- 【SQL】Oracle分页查询的三种方法
- oracle分页查询结果集重复问题&解决方法
- 分页显示问题的解决方法(jsp,sqlserver,mysql,oracle)
- ORACLE分页存储过程及其使用方法
- 分页显示问题的解决方法(jsp,sqlserver,mysql,oracle)
- oracle 分页查询的方法,以及page实体类
- Oracle分页查询的三种方法
- Oracle排序分页方法
- Oracle中的SQL分页查询原理和方法详解
- Oracle分页查询中排序与效率问题解决方法详解
- iBatis为业务对象添加可分页方法,扩展方法,调用Oracle