看到網上說select * from ( select row_.*, rownum rownum_ from (sql) row_ where rownum <= ?) where rownum_ >?
這種方法是最快的,特做實驗驗證之
select row_.*, rownum rownum_ from (select * from web_video) row_ where rownum BETWEEN 1 and 100
0.05675s 0.1181s
select row_.*, rownum rownum_ from (select * from web_video) row_ where rownum BETWEEN 100 and 1000
22.269s
select * from ( select row_.*, rownum rownum_ from (select * from web_video) row_ where rownum <= 100) where rownum_ >0
這種方法是最快的,特做實驗驗證之
select row_.*, rownum rownum_ from (select * from web_video) row_ where rownum BETWEEN 1 and 100
0.05675s 0.1181s
select row_.*, rownum rownum_ from (select * from web_video) row_ where rownum BETWEEN 100 and 1000
22.269s
select * from ( select row_.*, rownum rownum_ from (select * from web_video) row_ where rownum <= 100) where rownum_ >0
0.156s
select * from ( select row_.*, rownum rownum_ from (select * from web_video) row_ where rownum <= 1000) where rownum_ >100
0.037s