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: NHibernate query performance issue
PostPosted: Tue May 27, 2008 10:53 am 
Newbie

Joined: Tue May 27, 2008 10:13 am
Posts: 2
I have two methods: RenderFormats() and RenderInsurProducts().

The first method obtains some data from DB using simple query: "select from Format f order by f.Name". After the data is loaded and presented, the RenderInsurProducts() method is invoked.

The second method does similar thing using similar query.

The problem is long time of execution of second method. It takes about 5 seconds to obtain the data using ISession.

During execution of the second query, NHibernate is getting property values of entities loaded in the first query. It looks like NHibernate is looking for cached entities. Probably, this is the reason of slow query execution.

I used SQL Server Profiler to watch time of query execution. During debugging RenderInsurProducts() method I noticed, that when the query was displayed in the Profiler, the rendering starts immediately, but it has taken a few seconds before the query displayed in the Profiler.

When I swap these methods, the execution of both methods is fast.

Im using NHibernate v1.2.1 with SQL Server 2005.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 27, 2008 3:49 pm 
Newbie

Joined: Tue May 27, 2008 10:13 am
Posts: 2
The reason of this issue was overuse of keeping many entities in memory, which contained much binary data.

During second query execution, NHibernate was trying to find entities kept in cache. Comparing binary data took much time.


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.