Is there a way to make an Oracle
query behave like it contains a MySQL limit
clause?
In MySQL
, I can do this:
I did some performance testing for the following approaches:
select * from (
select a.*, ROWNUM rnum from (
select * from (
select * from (
select statement, rownum as RN with order by clause
) where a.rn >= MIN_ROW and a.rn <= MAX_ROW
Table had 10 million records, sort was on an unindexed datetime row:
Selecting first 10 rows took:
Selecting rows between 100,000 and 100,010:
Selecting rows between 9,000,000 and 9,000,010: