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: Improving performance of Importer - PreparedStatements
PostPosted: Mon Aug 07, 2006 1:39 pm 
Newbie

Joined: Mon Jun 19, 2006 5:35 am
Posts: 14
Hi all,

I'm optimizing an import process.

Characteristics are as follows:
* First a new schema is created (DROP + CREATE DATABASE)
* No multithreading - Only one thread is inserting records
* No other processes are accesing the database at time of import
* Database: MySQL 5.0
* Only one Hibernate session is used
* Connection is provided externally from Hibernate (e.g. no datasource)
* Only INSERT + SELECT, no DELETE

The Netbeans 5.0 Profiler shows that about 25% of the total import time is spent in
* AbstractBatcher#prepareBatchStatement - 19,5%
* AbstractBatcher#prepareSelectStatement - 6%

I think this could be optimized by re-using prepared statements. Since I'm using the same java.sql.Connection throughout the whole import, it is at least theoretically possible.

http://www.hibernate.org/15.html mentions PreparedStatement caching as a performance optimization, but I haven't found such a cache after a first peek into the Hibernate Source Code.

Any thoughts ?
Thx in advance


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 07, 2006 3:07 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
use a proper connectionpool or driver that does if effectively.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 08, 2006 3:03 am 
Newbie

Joined: Mon Jun 19, 2006 5:35 am
Posts: 14
[quote="max"]use a proper connectionpool or driver that does if effectively.[/quote]

Thx I'll do that. I think it would be a good idea to add this hint to the Performance FAQ.


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.