-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: paging performance problem
PostPosted: Thu Aug 25, 2005 11:13 am 
Newbie

Joined: Thu Dec 16, 2004 12:56 pm
Posts: 9
Hi,
I have performance problem using hibernate's paging strategy(setFirstResult() and setMaxResults()) with Oracle DB. The first 10 records is fast, but when I want to view the records with rownum between 2000 and 2010 is very very slowly.
I looked at the Sql generated, and this script is coming slowly when the rownum is “big”:

select * from
( select row_.*, rownum rownum_ from
(
select FIELD1, FIELD1 … from MY_TABLE
)
row_ where rownum <= 2230)
where rownum_ > 2220

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 25, 2005 1:59 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
try ScrollableResultSet (see documentation) - setFirstResult and setMaxResult is hack for oracle
(mysql and postgreslq have limit clause - it isn't sql standard) and it work bad for oracle

- with ScrollableResultset you make one query for all rows and with setFirstResult and setMaxResult you make query for every page (and it is slow query, special with order by)
It doesn't work with oracle < 8.1 and order by

hibernate developers favorite setFirstResult/setMaxResult - I don't know why, but I think because mysql and postgresl haven't scrollable cursor (last postgresql have this feature)
- this databases load all query rows in memory and have limit for big query list

regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.