时间:2021-07-01 10:21:17 帮助过:16人阅读
Oracle分页大家一般使用这种形式 SELECT * FROM ( SELECT A.*, rownum r FROM ( SELECT * FROM Artic
Oracle分页大家一般使用这种形式
SELECT * FROM
(
SELECT A.*, rownum r
FROM
(
SELECT *
FROM Articles
ORDER BY PubTime DESC
) A
) B
WHERE r <= PageUpperBound
and r > PageLowerBound;
在很多时候,并不需要排序,而是要进行多表的联查计算等,这个时候数据多了就会显的很慢
发现慢就慢在Order By上
更改如下:
SELECT * FROM
(
SELECT A.*, rownum r
FROM
(
SELECT *
FROM Articles
) A
WHERE rownum <= PageUpperBound ORDER BY PubTime DESC //Order by 放这来
)B
and r > PageLowerBound;