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.  [ 7 posts ] 
Author Message
 Post subject: Commit 180.000 rows
PostPosted: Sun Mar 15, 2009 5:38 am 
Newbie

Joined: Sun Mar 15, 2009 5:31 am
Posts: 6
I made an small application which will copy data (180.000 rows) from AS400 DB2 to MySQL database.

The application is built using hibernate and spring.

However, the commit operation take about 30 - 60 minutes (1 hour).

For those 180.000 rows, is this time normal?

Is there any way to improve the commit operation?

Thanks in advance

_________________
Marcos de Sousa


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 15, 2009 12:38 pm 
Newbie

Joined: Sun Mar 15, 2009 12:33 pm
Posts: 1
Hi,

do You execute entire operation in transaction?
In 1 transaction or multiple transactions?

I had same story few years ago.
At first each INSERT/UPDATE statement were done in 1 transaction.
Such process was very slow.

Then I have put that in many transactions with 5-50 statements in single transaction. Entire proccess improved.
Deal with that and check.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 15, 2009 10:25 pm 
Senior
Senior

Joined: Wed Sep 19, 2007 9:31 pm
Posts: 191
Location: Khuntien (Indonesia)
tgreg wrote:
Then I have put that in many transactions with 5-50 statements in single transaction. Entire proccess improved.
Deal with that and check.


Hi,

Would you mind to post the sample please? so, it can increase my knowledge. Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 16, 2009 4:44 am 
Newbie

Joined: Sun Mar 15, 2009 5:31 am
Posts: 6
tgreg wrote:
Hi,

do You execute entire operation in transaction?
In 1 transaction or multiple transactions?

I had same story few years ago.
At first each INSERT/UPDATE statement were done in 1 transaction.
Such process was very slow.

Then I have put that in many transactions with 5-50 statements in single transaction. Entire proccess improved.
Deal with that and check.


Yes, it is with only 1 transaction.

As SIau_Tie said, Can you share your code?

Thanks in advance,

_________________
Marcos de Sousa


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 16, 2009 7:43 am 
Newbie

Joined: Sun Mar 15, 2009 5:31 am
Posts: 6
Solution is here http://www.hibernate.org/hib_docs/refer ... batch.html

_________________
Marcos de Sousa


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 16, 2009 8:08 am 
Senior
Senior

Joined: Wed Sep 19, 2007 9:31 pm
Posts: 191
Location: Khuntien (Indonesia)
marcos.sousa wrote:


Thanks, I have already known this way.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 18, 2009 5:50 am 
Newbie

Joined: Sun Mar 15, 2009 5:31 am
Posts: 6
Hibernate is really cool. Hibernate is fast enough.

It can insert 10.000 rows in 6 seconds.

So, I was debugging to see what was the problem.

The problem is with jasypt encription, so there is nothing related with hibernate. The encription process happen when commiting data.

The solution to this problem is use hibernate paging + batch processing with native sql.

Why native sql:
> manually I will encript using concurrence framework, to resolve slow of encryption process
> insert chunk of 1000 rows using session.createSQLQuery(queryString).executeUpdate();

_________________
Marcos de Sousa


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