`

Oracle常用分页语句性能比较

阅读更多
分页一:
select b.* from
(
  select a.*,rownum num from
  (
    select * from xg.sys_operators t
    order by to_number(t.op_id)
  ) a
  where rownum <= 5000
) b
where num > 4990



分页二:
select * from
(
   select rid,num from
  (
    select rid,rownum num from
    (
      select rowid rid from xg.sys_operators t
      order by to_number(t.op_id)
    ) a
    where rownum <= 5000
  ) b
  where num > 4990
) c,xg.sys_operators s
where c.rid = s.rowid 
order by c.num


性能比较:分页一在表中数据量不是很大的时候检索效率比较高一些,分页二在表中数据量比较大的时候效率会高些。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics