-->
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.  [ 1 post ] 
Author Message
 Post subject: PERFORMANCE, BATCH SIZE, MASS INSERTION
PostPosted: Mon Feb 28, 2005 7:05 am 
Beginner
Beginner

Joined: Mon Jun 07, 2004 4:31 pm
Posts: 45
Location: France
Hibernate version:
2.1.8

Mapping documents:
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping package="com.cegedim.example.domain">

<class name="Tirage" table="TIRAGE">

<id name="tirageID" column="TIRAGE_ID" type="java.lang.Long">
<generator class="native"/>
</id>

<property
name="date"
column="DATE"
type="java.util.Date"/>

<property
name="nbGagnant"
column="NBGAGNANT"
type="java.lang.Integer"/>

<set name="numerosGagnants" lazy="true">
<key column="TIRAGE_ID"/>
<one-to-many class="com.cegedim.example.domain.NumeroGagnant"/>
</set>

<many-to-one name="loto" class="com.cegedim.example.domain.Loto" column="LOTO_ID"/>

</class>

</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
Transaction tx = session.beginTransaction();
for( int i=0 ; i<count ; i++ )
{
Tirage tirage = new Tirage( new Date(System.currentTimeMillis()),
new Integer(0),
loto,
null);
session.save(tirage);
}
session.flush();
tx.commit();


Name and version of the database you are using:
MySQL 4.0.23

Hibernate.properties:
hibernate.dialect net.sf.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class = com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql://localhost/loto?autoreconnect=true
hibernate.connection.username=root
hibernate.connection.password=
hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect
hibernate.show_sql = false
hibernate.cache.use_second_level_cache = false
hibernate.jdbc.batch_size = 20

Questions:

I want to proceed mass insertion. About 60.000 records.
I enable batch-size but it seems not work.
The goal is to have same performance with Hibernate and SQL native
I make a test application to mesure performance
The test is 20 pass of 100 inserts and 20 pass of 1000 inserts

Performance reports

20*100 inserts
Average Hibernate = 83.5
Average native preparestatement = 43.8
Performance ratio = 1.906392694063927

20*1000 inserts
Average Hibernate = 421.0
Average native preparestatement = 213.05
Performance ratio = 1.9760619572870217


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.