[hibernate-dev] batch-size algorithm

Emmanuel Bernard emmanuel at hibernate.org
Tue Sep 26 19:06:34 EDT 2006


Currently we create several loaders following a certain algorithm
Why don't we create a single loader of batch-size and duplicate ids in 
the in clause to match unfilled parameters

batch-size = 20
uninitialized proxies 17

current algorithm
select * from Table where id in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
select * from Table where id in (11, 12, 13, 14, 15, 16, 17)

current algorithm
select * from Table where id in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
13, 14, 15, 16, 17, 17, 17, 17)

This would reduce the memory footprint and reduce the prepared statement 
pool needed

This case is a sample but it shines when people set up a batch-size of 
100 since the number of queries triggered can drop from 5 to 1 query for 
98 uninitialized proxies



More information about the hibernate-dev mailing list