1.普通方式:
select object_name,object_id,status
from
(
select object_name,object_id,status,rownum rn
from(
select object_name,object_id,status
from test_paging
where owner='SYS'
AND object_type='TABLE'
order by created
)
where rownum<=500
)
where rn>=491
2.rowid方式:
select object_name,object_id,status
from
(
select rid from
(
select rid ,rownum rn
from
(
select rowid rid
from test_paging
where owner='SYS'
AND OBJECT_TYPE='TABLE'
order by created
)
where rownum<=500
)
where rn>=491
) t,test_paging s
where t.rid=s.rowid;
书上曾经提到:
当第一页查询的时候,普通方式可能要优于rowid方式
当越往后查询,明显rowid方式要快
可是我在环境上测试,发现第一中方式却比rowid的逻辑读要少。
我的表的构造来源all_objects,
test_paging上索引是建立在(owner,object_type,created,status)
马上高手指点下。。。。
oracle分页优化
转载下一篇:我的友情链接
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
MySQL百万级数据分页查询优化
MySQL优化
字段 分页查询 偏移量 -
[oracle]分页查询sql
自己去测试了下几种方法。。。还是用rownum比较好。
oracle 方法 效率 分页 sql