1.根據rowid來分
select * from t_xiaoxi where rowid in(select rid from (select rownum rn,rid from(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_xiaoxi t) where rk<10000 and rk>9980;
執行時間1.01秒
3.按rownum來分
select * from(select t.*,rownum rn from(select * from t_xiaoxi order by cid desc) t where rownum<10000) where
rn>9980;執行時間0.1秒
其中t_xiaoxi為表名稱,cid為表的關鍵字段,取按cid降序排序後的第9981-9999條記錄,t_xiaoxi表有70000多條記錄
個人感覺1的效率最好,3次之,2最差
oracle分頁語句
1.根據rowid來分 select from t xiaoxi where rowid in select rid from select rownum rn,rid from select rowid rid,cid from t xiaoxi order by cid desc where r...
Oracle分頁語句
select from select a.rownum rd from select from tablename where condition order by condition a where rownum endpage pagesize where rd startpage pagesi...
Oracle分頁語句
select from select a.rownum r from 這裡的sql可以改成你真正要執行的sql select from articles order by pubtime desc a 用上面的sql得回來的集合,使用rownum去比對,這樣rownum就會從這 個集合的第一筆資料開...