-->
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: batch inserts & MariaDB
PostPosted: Tue Mar 01, 2016 1:07 pm 
Beginner
Beginner

Joined: Wed Mar 03, 2010 3:35 pm
Posts: 37
Hi,
We are considering to replace our existing DB2 with Maria DB . We current use Sequence objects in DB2 for primary key generation. One of the tings I came across was that if using an identity generator instead of a sequence generator (since user defined sequence objects dont seem to be supported in Maria DB as its similar to MySQL) , jdbc batch inserts will be implicitly disabled if using an identity generator. More info below in an older thread related to that (though it is related to MySQL),

viewtopic.php?p=2436697


Using the Table generation strategy seems to be one option, but it has its own pros and cons when coming from a Sequence generation strategy which we currently have.
Any suggestions for other options related to above will be helpful.

regards
aravias


Top
 Profile  
 
 Post subject: Re: batch inserts & MariaDB
PostPosted: Tue Mar 01, 2016 4:47 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1638
Location: Romania
You will not be able to use JDBC batching for insert statements only. Updates and deletes are batchable on MySQL and MariaDB even when using the IDENTITY geneartor.

In my book, I run some tests to compare if it's worth to use the table generator and take advantage of insert batching, but the truth is that it's still slower than IDENTITY. The table generator uses row-level locking, and even if you use the pooled optimizer, the row-level locking and the fact that you require a separate transcation will impact performance, especially when increasing concurrency.

All in all, use IDENTITY even if the inserts are not batched.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
 Post subject: Re: batch inserts & MariaDB
PostPosted: Tue Mar 01, 2016 5:49 pm 
Beginner
Beginner

Joined: Wed Mar 03, 2010 3:35 pm
Posts: 37
okay thanks.


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.