MyBatis RowBounds vs Oracle pagination query using rownum and nested subquery

I want to know which of the following performs better in terms of time to execute a query with 100k + records

1) Page hiding

SELECT *
FROM  (
   SELECT id, col1, col2, rownum rn
   FROM (
      SELECT /*+ first_rows(50) */ id, col1, col2
      FROM   table1
      ORDER  BY id DESC
   )
   WHERE   rownum <= 50
)
WHERE  rn >= 20;

2) Pagination with MyBatis RowBounds .

MyBatis RowBounds uses regular JDBC, and after starting the selection, it skips the first 20 records and then selects the next 30 (pages).

Also, will the MyBatis method slow down as the number of pages increases, since more lines need to be skipped?

+5
source share
1 answer

JDBC 20 , , . , .

, , . , , - , , , , .

+1

All Articles