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: Fast Batch Insert Patch For Complex Cascading Objects
PostPosted: Thu Dec 14, 2006 2:40 pm 
Newbie

Joined: Thu Dec 14, 2006 2:25 pm
Posts: 1
Hibernate is clearly a great ORM. However its speed in inserting complex cascading object graphs leaves something to be desired because each object is persisted serially in the order that the cascade is called. When inserting a large number of identical objects batching cannot be used since inserts cannot be grouped by the JDBC batching mechanism.

e.g. A has two children B and C that both have fks to the A. If I persist n As the insert order is
insert A
insert B
insert C
insert A
insert B
insert C
...
...

The number of insert statements generated is n * (1 + total number of children in the tree) that A has to insert. For high latency connections this is a killer on performance.

In some cases it is possible to rearrange the inserts so that you group all the objects of similar a similar type together
e.g.
insert A
insert A
...
insert B
insert B
...
insert C
insert C

Then the hibernate can batch similar inserts together and reduce the number of round trips (plus the savings on the server side).

We have a patch that works for us to do this, but it obviously needs testing on other peoples insert graphs. We have experienced several hundred percent speed increase in our real world testing.

Please see http://opensource.atlassian.com/projects/hibernate/browse/HHH-1

to get the patch against the 3.2 . Any and all feedback would be appreciated.


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.