-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate query performance problem
PostPosted: Wed Sep 02, 2009 5:57 pm 
Newbie

Joined: Tue Mar 17, 2009 5:46 pm
Posts: 3
Hi,

I have problem with query speed in my application. Basically during one transaction in one place in my code I read a lot of entities (less then hundred in one query but thousands of them in total) with hibernate query. This query became database bottleneck, so I run profiler. I was surprised, that after some experiments, I managed to remove that bottleneck just by using EntityManager.clear() method. My question is: is there a cleaner way to speed up query. I guess it must be related with hibernate session first level cache.

Database model:
Code:
public class E implements Serializable {
@EmbeddedId
private Id id;
}


Code:
@Embeddable
public class Id implements Serializable {
Long a;
Long b;
}


Query:
Code:
SELECT e from E e where e.id.A = :A


Without using EntityManager.clear() during transaction running this query takes about 80% of computation time.
With using EntityManager.clear() it takes like 15%

Kind regards,
Karol


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

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.