[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1) Optimize Hibernate for the bulk insertion of related entities

Martin Ross (JIRA) noreply at atlassian.com
Thu Dec 14 02:44:05 EST 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1?page=comments#action_25630 ] 

Martin Ross commented on HHH-1:
-------------------------------

We have something that works (for our moderately) complex object.  I will submit patch files against the 3.2 branch.  We are seeing real world increases of several hundred percent performance on our system.   Please test and give feedback.

Since hibernate batching occurs using PreparedStatement it appears that you need to do a few things to get the MySQL driver to actual even use batching.
A)  Use the 5.0.4 connector.  The later versions of the 3.1.x series might work.
B)  Set useServerPrepStmts=false . MySQL server side prepared statements can't batch yet.
C) Set rewriteBatchedStatements=true .  This is the import part.

Also we have discovered some bugs with MySQL and batch inserts.  

I have filed two issues on MySQL bugs site http://bugs.mysql.com/bug.php?id=25025 and http://bugs.mysql.com/bug.php?id=25047 .  Until these are fixed you will 
A)  Need to make sure that hibernate show_sql property is off 
B)  the "insert (..)  values (?,?,....)" insert statements generated by hibernate MUST be uppercased. You may need to hack the driver.  Or just hack the MySQL connector 

> Optimize Hibernate for the bulk insertion of related entities
> -------------------------------------------------------------
>
>          Key: HHH-1
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1
>      Project: Hibernate3
>         Type: New Feature

>   Components: core
>  Environment: Hibernate 1.2, MySql 3.1
>     Reporter: Bradley Leupen
>     Priority: Minor

>
>
> It is currently difficult to batch the creation of persistent entities that maintain associations with other entities.
> Add necessary api to hibernate to support the save or update of a collection of entities. An optimization can be applied in this scenario to group inserts / updates by entity class, or table. This will enable the hibernate engine to utilize batching if available, drastically improving performance over a network. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list