-->
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.  [ 4 posts ] 
Author Message
 Post subject: Batch inserts with timed flush?
PostPosted: Sat Mar 03, 2012 2:14 pm 
Regular
Regular

Joined: Wed Jan 21, 2009 8:41 pm
Posts: 54
One approach I've seen is to collect items in a list and then process the list when you flush the batch when it hits the batch size but also setup an executor to flush the list on a periodic basis.

I'm wondering if the list is needed or whether you you simply just need to flush the entity manager periodically.


Top
 Profile  
 
 Post subject: Re: Batch inserts with timed flush?
PostPosted: Mon Mar 05, 2012 3:17 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Quote:
One approach I've seen is to collect items in a list and then process the list when you flush the batch


Do you speak of hibernate's internal code (how batching is implemented in hibernate) or do you speak about
user-code using hibernate?


Top
 Profile  
 
 Post subject: Re: Batch inserts with timed flush?
PostPosted: Mon Mar 05, 2012 8:27 pm 
Regular
Regular

Joined: Wed Jan 21, 2009 8:41 pm
Posts: 54
My understanding is that if you're using batch inserts, internally there's nothing that will guarantee your batch commits based on a time interval prior to hitting your batch size?

pb00067 wrote:
Quote:
One approach I've seen is to collect items in a list and then process the list when you flush the batch


Do you speak of hibernate's internal code (how batching is implemented in hibernate) or do you speak about
user-code using hibernate?


Top
 Profile  
 
 Post subject: Re: Batch inserts with timed flush?
PostPosted: Tue Mar 06, 2012 3:56 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Quote:
My understanding is that if you're using batch inserts, internally there's nothing that will guarantee your batch commits based on a time interval prior to hitting your batch size?


Affirmative,
there's nothing hat will flush your batch based on a time interval prior to hitting your batch size!

But on the other hand I also cannot figure out, for what purpose hibernate should do something like that.
Usually applications do use at least READ-COMMITED isolation level,
so other transactions cannot see the modified data until your transaction is commited.
So it this sense it changes nothing if your batch is flushed earlies or later!

N.B.: when the batch size is completed, the batch gets flushed (transaction continues) not commited!


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