If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > performance issue with rowid

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-28-10, 02:43
scharan07 scharan07 is offline
Registered User
 
Join Date: Jul 2009
Location: Mumbai
Posts: 21
performance issue with rowid

Hi,

I have an query which is done for pagination based on rownum

select * from ( select row_.*, rownum rownum_ from (.. my query ..) ASC) row_ where rownum <= 30) where rownum_ > 20

Actually this pagination query is generated by hibernate ORM java tool.

There is an issue we are getting some records are repeating in multiple pages.
to fix this issue we added order by rowid to my query. But this is hitting performance by 2 secs in 6 lacs records in table.

can any suggestions to fix the pagination issue with out performance hit.

Regards,
Charan
Reply With Quote
  #2 (permalink)  
Old 07-28-10, 07:20
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
ROWID is an odd thing to order by. If the displayed order is of no importance, try ordering by an indexed column such as the primary key of the main table. This might avoid a SORT operation.
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #3 (permalink)  
Old 07-28-10, 09:54
scharan07 scharan07 is offline
Registered User
 
Join Date: Jul 2009
Location: Mumbai
Posts: 21
I was already sorting on column (which is not unique values).

if i do with primary keys it is also hitting performance, than the row id.

thats why i used row id.
Reply With Quote
  #4 (permalink)  
Old 07-29-10, 03:53
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
OK, fair enough. Well your issue is really one of tuning the underlying query, not with the pagination as such. Have you used autotrace to see what it is doing?

Since you are displaying a pagination result set, you are more interested in getting some rows back early rather than getting the whole result set quickly, so you could try adding a FIRST_ROWS hint.
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #5 (permalink)  
Old 08-04-10, 01:49
scharan07 scharan07 is offline
Registered User
 
Join Date: Jul 2009
Location: Mumbai
Posts: 21
Thanks for you reply

But i can't do in my application and test with hints we write HQL queries which does not support the hints of oracle can you suggest me any alternative solution as such doing with normal quering.
Reply With Quote
Reply

Tags
rowid performance issue

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On