Oracle分頁大家一般使用這種形式
SELECT * FROM
(
SELECT A
FROM
(
SELECT *
FROM Articles
ORDER BY PubTime DESC
) A
) B
WHERE r <= PageUpperBound
and r > PageLowerBound;
在很多時候
發現慢就慢在Order By上
更改如下
SELECT * FROM
(
SELECT A
FROM
(
SELECT *
FROM Articles
) A
WHERE rownum <= PageUpperBound ORDER BY PubTime DESC //Order by 放這來
)B
and r > PageLowerBound;
From:http://tw.wingwit.com/Article/program/Oracle/201311/17285.html