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: sql through nhibernate is slow
PostPosted: Wed Jan 24, 2007 6:33 pm 
Newbie

Joined: Fri Dec 09, 2005 2:22 pm
Posts: 16
Hello,

having a really slow session.Find() call, I copied/paste the hibernate generated sql to a db client and found out the query is fast !
I debugged the hibernate code and I spend my time in the result set reader.Read(), so in the db driver (oracle).

Why should I experience a difference in the execution time between nhibernate and a sql client ?

thank you


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 25, 2007 11:01 am 
Newbie

Joined: Fri Dec 09, 2005 2:22 pm
Posts: 16
I investigated further and the problem comes from the parameter passing.

If I use the following, this is fast:
Session.Find("select d from ... a where a.Value='"+code+"'");

If I use the following, it's terribly slow:
Session.Find("select d from ... where a.Value=?", code, NHibernateUtil.String);

Is this an oracle driver bug ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 25, 2007 12:01 pm 
Newbie

Joined: Fri Dec 09, 2005 2:22 pm
Posts: 16
here is the answer:
oracle does not know how to generate a fast plan with a bound variable in that case...


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.