回覆列表
-
1 # maimi32709
-
2 # 使用者2458114238191884
sql語句如下:
分頁1
SELECT *
FROM (Select ROWNUM AS ROWNO, T.*
from 表名 T(別名)
where 表字段 between to_date("20060501", "yyyymmdd") and to_date("20060731", "yyyymmdd")
AND ROWNUM
WHERE TABLE_ALIAS.ROWNO >= 10;
經過測試,此方法成本最低,只巢狀一層,速度最快,即使查詢的資料量再大,也幾乎不受影響,速度依然.
分頁2:
SELECT *
FROM (SELECT TT.*, ROWNUM AS ROWNO
FROM (Select t.*
from 表名 T(別名)
where flight_date between to_date("20060501", "yyyymmdd") and
to_date("20060531", "yyyymmdd")
ORDER BY FACT_UP_TIME, flight_no) TT(別名二)
WHERE ROWNUM
where TABLE_ALIAS.rowno >= 10;
經過測試,此方法隨著查詢範圍的擴大,速度也會越來越慢,
sql語句如下:分頁1SELECT * FROM (Select ROWNUM AS ROWNO, T.* from 表名 T(別名) where 表字段 between to_date("20060501", "yyyymmdd") and to_date("20060731", "yyyymmdd") AND ROWNUM = 10;經過測試,此方法成本最低,只巢狀一層,速度最快,即使查詢的資料量再大,也幾乎不受影響,速度依然.分頁2:SELECT * FROM (SELECT TT.*, ROWNUM AS ROWNO FROM (Select t.* from 表名 T(別名) where flight_date between to_date("20060501", "yyyymmdd") and to_date("20060531", "yyyymmdd") ORDER BY FACT_UP_TIME, flight_no) TT(別名二) WHERE ROWNUM = 10;經過測試,此方法隨著查詢範圍的擴大,速度也會越來越慢,