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)
马上高手指点下。。。。