problem method with select huge number of records and display...too slow

I am facing a problem about the method to select to process and display. writing a store procedure for Oracle database.
I am doing the enquiry screen something like page 1, until page 100. each page have display 100 row.
each time have select more than 10 or 20 thousand records.. then using looping get from line
1000 to line 1100. then pass to front end and display, it take too long time.. about 5 seconds to 9 seconds.. make it less than 1 second.
anyone can help me to improve the speed?
any idea something like... just select from XXX row to XXX row.. then pass to front end.. without any looping. or other better idea..
thank you ..hopefully probvide with the syntax
gagajaniceAsked:
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.

sshah254Commented:
select * from (select * from table order by something) where rownum between x and y

As long as your 'something' is indexed, you should be fine.

You should always be retrieving records that fit one page, no more.

Ss
gagajaniceAuthor Commented:
thanks for ur reply..

the between X and Y, the "X" .. is only work with 1... if i put other number, other than 1... it will return empty..
PilouteCommented:
Hi all,

Rownum is a pseudo-col in oracle and has a very specific use. It is assigned just before the server returns a result. In other words, your query might have any conditions, you will always have rownum = 1, 2, 3, etc...

Check this example, and adapt it to your need :
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:76812348057

Cheers,
P
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

PilouteCommented:
Another thing about speeding up such a query is to make a staging/temporary table that stores an already sorted resultset.

You would avoid 'reading the whole' + 'sorting' every time. It would request an initial load (so probably a first wait time) but it will surely speed up navigation'.

P

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
jaiminpsoniCommented:
select * from (select * from (select * from pagination order by id) where rownum <= ENDNUM order by id desc) where rownum <= (ENDNUM-STARTNUM+1) order by id;

replace startnum and endnum with appt values.

I am not very sure about performance.
gagajaniceAuthor Commented:
Thank you... ur method is working!!! hhihi
PilouteCommented:
welcome
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.