oracle pagination query performance issue

The following query for paginating say 2000 records is having performace issues.
for initial pages its fine.As the page number passed increases, time for execution increases.
I need some way to skip already traveres records or some alternative way to query reults speedily.
Say i am showing 20 records per page in total of 50 pages

and i want records from 980 to 1000.

How can i spped this query up?


SELECT * FROM
(
    SELECT b.*, rownum r
    FROM
    (
          SELECT AA,BB,CC,DD
  FROM table tab  WHERE AA= 'testdata1'
                AND B = 'testdata2'
                AND C >= 'date1' AND B < 'date2' -- C is date column
                AND D  BETWEEN 1 AND 1000000  -- amount column
                ORDER BY C DESC -- Date column C is indexed
    ) b
    WHERE rownum < ((Pagenum * Pagesize) + 1 )
)
WHERE r >= (((Pagenum-1) * Pagesize) + 1)
DevildibAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
Try something like this:
select whatever from (
select whatever, row_number() over(order by some_column) rn
from some_table
)
where rn between pagenum*pagesize and (pagenum+1)*pagesize

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Geert GOracle dbaCommented:
either:
upgrade to oracle 12
a new feature of oracle 12 is an extended clause for limiting the rows

http://docs.oracle.com/database/121/SQLRF/statements_10002.htm#SQLRF55636

or use an advanced grid component which has the pagination built in
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.