Link to home
Start Free TrialLog in
Avatar of gagajanice
gagajanice

asked on

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
Avatar of sshah254
sshah254

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
Avatar of gagajanice

ASKER

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..
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
ASKER CERTIFIED SOLUTION
Avatar of Piloute
Piloute
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Thank you... ur method is working!!! hhihi
welcome