-->
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.  [ 12 posts ] 
Author Message
 Post subject: Feature Request: Alternate batch-size semantics
PostPosted: Wed Dec 21, 2005 7:14 pm 
Regular
Regular

Joined: Tue May 31, 2005 9:55 am
Posts: 67
The batch-size capability is extremely helpful in avoiding the N+1 select problem. However, NHibernate follows Hibernates semantics such that if the number of candidate entities is less than the batch-size, then the sqrt(batch-size) is attempted. If the number of candidates is still less than this, then a batch-size of 1 is used. Would it be possible to provide an alternate usage (through a config setting) such that the min(candiates, batch-size) is used.

e.g. if batch-size is 10 and 8 candidate entities are found, then a single query with 8 enttity primary keys is used). If 12 are found, then 2 queries are performed with 8 and 2 respectively. This would really give more control to help control the N+1 select problem.

Thanks,
craig


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 24, 2005 10:13 am 
Regular
Regular

Joined: Tue May 31, 2005 9:55 am
Posts: 67
Is there a proper place to list feature requests?

craig


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 24, 2005 11:22 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Our JIRA is probably the place, but adding features is very low priority for me right now (if the feature comes in the form of a patch, then the priority could be a bit higher).


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 24, 2005 2:43 pm 
Regular
Regular

Joined: Tue May 31, 2005 9:55 am
Posts: 67
Ok Sergey,

I know you are super-busy so I will work on creating a patch for you. I hope to be able to use a simple strategy pattern to accomodate alternate batching schemes.

Thanks again,
craig


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 24, 2005 5:28 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
It's not that I'm busy, I just don't want to destabilize 1.0.x with new features, and I haven't completely decided yet how the future versions of NH will be done. It's likely that I will just port Hibernate 3, trying to stay as close as possible to the Java version. If this turns out to be the case, then all the feature requests will have to go through Hibernate team first.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 26, 2005 7:31 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
in H3, the algorithm has changed to use n-1 = n /2 instead of sqrt(n)
The issue should be minimized.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 28, 2005 11:14 pm 
Regular
Regular

Joined: Tue May 31, 2005 9:55 am
Posts: 67
That makes sense. If I provide a patch, would you still consider including it?

craig


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 29, 2005 6:50 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Yes. If the implementation, or at least the algorithm, is similar to H3, I will include it. By the way, I'm going to release 1.0.2 soon since there are only a few open issues left, so hurry up :-)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 03, 2006 4:13 pm 
Regular
Regular

Joined: Tue May 31, 2005 9:55 am
Posts: 67
Hello Sergey,

Sorry for the late reply. I have been ill with the Flu for a couple of days. I plan on creating the patch tomorrow. Hopefully it is not too late.

thanks,
craig


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 04, 2006 9:05 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
cneuwirt wrote:
Hopefully it is not too late.


No-no, it's not. Plenty of time left :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 11, 2006 10:08 am 
Regular
Regular

Joined: Tue May 31, 2005 9:55 am
Posts: 67
Hello Sergey,

I have been looking through the Hibernate 3.1 code to try and match its sementics, but the NHibernate port differs enough, that I am not comfortable (or confident) with trying to match its semantics of the batching loaders and persisters. Since I am not familiar with the NHibernate porting decisions, I am not sure if the differences are irrelevant. In addition, the Hibernate 3.1 does not provide the ability to provide alternate batching strategies and that is the main thing I was going to add. Do you think it is valuable to provide the ability to plug in different batching strategies, or do you want NHibernate to use the new batching strategy in NHibernate 3.1 without providing the ability to change it.

thanks,
craig


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 11, 2006 11:11 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
It's enough to just change the current strategy to the one in Hibernate 3.1.


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