-->
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.  [ 3 posts ] 
Author Message
 Post subject: Oracle query very slow in Hibernate
PostPosted: Fri Sep 02, 2016 11:52 am 
Newbie

Joined: Tue Feb 23, 2016 10:21 am
Posts: 2
I have a problem with a query in my application performing very slow. Using hibernate 4.3.11 and Java EE 1.7 against an oracle 11g database.

I have a query I am using with a single bind parameter. I have hibernate.show_sql turned on and I can take the query from the log output and run an explain plan on it to see the cost is very low. Running the query directly against the database (using toad or sqlplus) takes 30ms. When it is executed in my application it takes over 15 seconds. Is it possible the query being run from hibernate is not what is being printed to the output log? Can someone tell me how to figure this out?

Thanks


Top
 Profile  
 
 Post subject: Re: Need help debugging slow query
PostPosted: Sat Sep 03, 2016 5:40 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1638
Location: Romania
Most likely that you are fetching a lot of data. The query on the DB side might take less because you don't transform the objects and process them from JDBC. If there are many records, try using pagination or batch processing.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
 Post subject: Re: Need help debugging slow query
PostPosted: Sat Sep 03, 2016 5:54 pm 
Newbie

Joined: Tue Feb 23, 2016 10:21 am
Posts: 2
After some more digging I have discovered this is a problem with Oracle Dates and Timestamps vs Java Date and Timestamp.

Relevant SO Topic: http://stackoverflow.com/questions/6612 ... imestamp-o


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.