-->
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: HIbernate performance flush v commit
PostPosted: Sat Apr 02, 2011 8:13 am 
Newbie

Joined: Fri Apr 01, 2011 4:59 am
Posts: 6
Im creating a hibernate component to interact with large incoming data to persist, both save(create) and update data with volumes in the million of rows.

I am aware of the main differences around flush v commit, for example flush syncing the "dirty" data into the persistable underlying data, and that flush allows you to sync with the underlying persistable data without actually committing so that the transaction can be rolled back if required. Commit essentially commits all persistable data to the database.

Whats a reasonable size to do a batch insert? IS 50 the max amount for reasonable performance so something like:

for (i < 1000000)

if(i % 50 ) {
session.flush()
}

I gather 50 should match the value in the hibernate.jdbc.batch_size 50


Top
 Profile  
 
 Post subject: Re: HIbernate performance flush v commit
PostPosted: Sun Apr 03, 2011 7:29 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
yes 50 is reasonable to start from, you can experiment with slightly higher or lower (100, 20) to see how performance is affected as it depends on your hardware, connectivity, database configuration and data sizes: hard to predict.

Make sure you also use session.clear(): flush won't remove existing (flushed) entities from the session, so you would run out of memory otherwise.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: HIbernate performance flush v commit
PostPosted: Mon Apr 04, 2011 6:34 am 
Newbie

Joined: Fri Apr 01, 2011 4:59 am
Posts: 6
Ok thank you for that.
I gather hibernate just batches up the inserts rather than one big insert with all the relevant data? Is it possible to use the oracle drivers to translate those individual inserts into one big insert with all the data? Something like you can do in MySQL?


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.