zoukankan      html  css  js  c++  java
  • oracle分页

    1.根据ROWID来分
    select * from student where rowid in (select rid from (select rownum rn, rid from (select rowid rid,cid from student order by cid desc) where rownum<10000) where rn > 9980) order by cid desc;
    执行时间0.03秒
    2.按分析函数来分
    select * from (select a.*, row_number() over(order by cid desc) rk from student a ) where rk < 10000 and rk > 9980;
    执行时间1.01秒
    3.按ROWNUM来分
    select * from (select t.*, rownum rn from (select * from student order by cid desc) t where rownum < 10000) where rn > 9980;
    执行时间0.1秒
    测试数据student表有7万多条。
    结论:1效率最高,3次之,2最差

  • 相关阅读:
    ubuntu系统安装初始化脚本
    21_多线程
    20_IO
    19_异常
    18_集合
    17_内部类和常用类
    16_接口
    15_abstract,static,final
    14_面向对象
    13_数组
  • 原文地址:https://www.cnblogs.com/qinjf/p/8379527.html
Copyright © 2011-2022 走看看