Hibernate & H2 Vs Hibernate & HSQLDB Embedded

Click to browse the complete benchmark resultsCompare * Oracle Database 11g* IBM DB2 10* Microsoft SQL Server 2008DataNucleus with Derby embeddedDataNucleus with H2 embeddedDataNucleus with HSQLDB embeddedDataNucleus with DB4O embeddedDataNucleus with Derby serverDataNucleus with H2 serverDataNucleus with MySQL serverDataNucleus with PostgreSQL serverEclipseLink with Derby embeddedEclipseLink with H2 embeddedEclipseLink with HSQLDB embeddedEclipseLink with SQLite embeddedEclipseLink with Derby serverEclipseLink with H2 serverEclipseLink with MySQL serverEclipseLink with PostgreSQL serverHibernate with Derby embeddedHibernate with H2 embeddedHibernate with HSQLDB embeddedHibernate with SQLite embeddedHibernate with Derby serverHibernate with H2 serverHibernate with MySQL serverHibernate with PostgreSQL serverOpenJPA with Derby embeddedOpenJPA with H2 embeddedOpenJPA with HSQLDB embeddedOpenJPA with Derby serverOpenJPA with H2 serverOpenJPA with MySQL serverOpenJPA with PostgreSQL serverObjectDB embeddedObjectDB serverwith* Oracle Database 11g* IBM DB2 10* Microsoft SQL Server 2008DataNucleus with Derby embeddedDataNucleus with H2 embeddedDataNucleus with HSQLDB embeddedDataNucleus with DB4O embeddedDataNucleus with Derby serverDataNucleus with H2 serverDataNucleus with MySQL serverDataNucleus with PostgreSQL serverEclipseLink with Derby embeddedEclipseLink with H2 embeddedEclipseLink with HSQLDB embeddedEclipseLink with SQLite embeddedEclipseLink with Derby serverEclipseLink with H2 serverEclipseLink with MySQL serverEclipseLink with PostgreSQL serverHibernate with Derby embeddedHibernate with H2 embeddedHibernate with HSQLDB embeddedHibernate with SQLite embeddedHibernate with Derby serverHibernate with H2 serverHibernate with MySQL serverHibernate with PostgreSQL serverOpenJPA with Derby embeddedOpenJPA with H2 embeddedOpenJPA with HSQLDB embeddedOpenJPA with Derby serverOpenJPA with H2 serverOpenJPA with MySQL serverOpenJPA with PostgreSQL serverObjectDB embeddedObjectDB serverComparison of Hibernate with H2 server vs Hibernate with HSQLDB embedded

Each of the following tables focuses on a specific database operation, where the last table presents average results comparison.

Speed comparison of JPA database persistence operations (normalized score, higher is better)

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 HibernateH2 serverHibernateHSQLDB embeddedHibernateH2 serverHibernateHSQLDB embeddedHibernateH2 serverHibernateHSQLDB embedded
Basic Person Test4.632.63.013.13.822.9
Element Collection Test3.715.11.18.22.411.7
Inheritance Test6.725.53.113.64.919.5
Indexing Test8.229.64.218.86.224.2
Graph (Binary Tree) Test3.413.83.915.63.714.7
Multithreading Test6.837.45.013.05.925.2
All Tests5.625.63.413.74.519.7

The results above show that in general Hibernate with HSQLDB embedded is much more efficient than Hibernate with H2 server in persisting JPA entity objects to the database. Comparing the normalized speed of Hibernate with H2 database server (4.5) to the normalized speed of Hibernate with HSQLDB embedded database (19.7) reveals that in these tests, Hibernate with HSQLDB embedded is 4.4 times faster than Hibernate with H2 server.

A large performance gap has been detected when using JPA element collections with large transaction size. Comparing the normalized speed of Hibernate with H2 database server (1.1) to the normalized speed of Hibernate with HSQLDB embedded database (8.2) reveals that in that case, Hibernate with HSQLDB embedded is 7.5 times faster than Hibernate with H2 server.

Speed comparison of JPA database retrieval operations (normalized score, higher is better)

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 HibernateH2 serverHibernateHSQLDB embeddedHibernateH2 serverHibernateHSQLDB embeddedHibernateH2 serverHibernateHSQLDB embedded
Basic Person Test3.124.86.016.44.620.6
Element Collection Test1.011.31.110.81.011.0
Inheritance Test2.921.77.621.05.221.3
Indexing Test2.611.97.021.54.816.7
Graph (Binary Tree) Test0.423.61.14.70.784.1
Multithreading Test6.519.810.521.58.520.6
All Tests2.815.55.616.04.215.7

The results above show that in general Hibernate with HSQLDB embedded is much more efficient than Hibernate with H2 server in retrieving JPA entity objects from the database. Comparing the normalized speed of Hibernate with H2 database server (4.2) to the normalized speed of Hibernate with HSQLDB embedded database (15.7) reveals that in these tests, Hibernate with HSQLDB embedded is 3.7 times faster than Hibernate with H2 server.

A huge performance gap has been detected when using JPA element collections with small retrieval size. Comparing the normalized speed of Hibernate with H2 database server (1.0) to the normalized speed of Hibernate with HSQLDB embedded database (11.3) reveals that in that case, Hibernate with HSQLDB embedded is 11.3 times faster than Hibernate with H2 server.

Speed comparison of JPA database query operations (normalized score, higher is better)

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 HibernateH2 serverHibernateHSQLDB embeddedHibernateH2 serverHibernateHSQLDB embeddedHibernateH2 serverHibernateHSQLDB embedded
Basic Person Test3.73.61.00.882.32.2
Element Collection Test3.73.40.631.72.22.6
Inheritance Test3.22.91.41.02.31.9
Indexing Test1.79.95.821.73.815.8
Multithreading Test1.11.10.880.581.00.82
All Tests2.74.21.95.22.34.7

The results above show that in general Hibernate with HSQLDB embedded is more efficient than Hibernate with H2 server in executing the tested JPA queries. Comparing the normalized speed of Hibernate with H2 database server (2.3) to the normalized speed of Hibernate with HSQLDB embedded database (4.7) reveals that in these tests, Hibernate with HSQLDB embedded is 2.0 times faster than Hibernate with H2 server.

A large performance gap has been detected when using database indexes with small retrieval size. Comparing the normalized speed of Hibernate with H2 database server (1.7) to the normalized speed of Hibernate with HSQLDB embedded database (9.9) reveals that in that case, Hibernate with HSQLDB embedded is 5.8 times faster than Hibernate with H2 server.

Speed comparison of JPA database update operations (normalized score, higher is better)

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 HibernateH2 serverHibernateHSQLDB embeddedHibernateH2 serverHibernateHSQLDB embeddedHibernateH2 serverHibernateHSQLDB embedded
Basic Person Test2.914.21.85.02.49.6
Element Collection Test2.610.11.15.61.97.8
Inheritance Test3.213.42.57.52.910.5
Indexing Test2.910.72.76.12.88.4
Graph (Binary Tree) Test1.23.70.432.50.793.1
Multithreading Test5.623.92.43.84.013.9
All Tests3.112.71.85.12.58.9

The results above show that in general Hibernate with HSQLDB embedded is much more efficient than Hibernate with H2 server in updating JPA entity objects in the database. Comparing the normalized speed of Hibernate with H2 database server (2.5) to the normalized speed of Hibernate with HSQLDB embedded database (8.9) reveals that in these tests, Hibernate with HSQLDB embedded is 3.6 times faster than Hibernate with H2 server.

A large performance gap has been detected when using graphs of objects with large transaction size. Comparing the normalized speed of Hibernate with H2 database server (0.43) to the normalized speed of Hibernate with HSQLDB embedded database (2.5) reveals that in that case, Hibernate with HSQLDB embedded is 5.8 times faster than Hibernate with H2 server.

Speed comparison of JPA database removal operations (normalized score, higher is better)

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 HibernateH2 serverHibernateHSQLDB embeddedHibernateH2 serverHibernateHSQLDB embeddedHibernateH2 serverHibernateHSQLDB embedded
Basic Person Test3.826.12.417.53.121.8
Element Collection Test1.99.11.15.21.57.1
Inheritance Test3.721.42.517.73.119.6
Indexing Test7.633.03.116.35.324.7
Graph (Binary Tree) Test0.995.40.918.20.956.8
Multithreading Test6.138.57.328.66.733.5
All Tests4.022.32.915.63.518.9

The results above show that in general Hibernate with HSQLDB embedded is much more efficient than Hibernate with H2 server in deleting JPA entity objects from the database. Comparing the normalized speed of Hibernate with H2 database server (3.5) to the normalized speed of Hibernate with HSQLDB embedded database (18.9) reveals that in these tests, Hibernate with HSQLDB embedded is 5.4 times faster than Hibernate with H2 server.

A large performance gap has been detected when using graphs of objects with large transaction size. Comparing the normalized speed of Hibernate with H2 database server (0.91) to the normalized speed of Hibernate with HSQLDB embedded database (8.2) reveals that in that case, Hibernate with HSQLDB embedded is 9.0 times faster than Hibernate with H2 server.

Comparison of JPA/Database speed - the averages (normalized score, higher is better)

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 HibernateH2 serverHibernateHSQLDB embeddedHibernateH2 serverHibernateHSQLDB embeddedHibernateH2 serverHibernateHSQLDB embedded
Basic Person Test3.620.22.810.63.215.4
Element Collection Test2.69.81.06.31.88.0
Inheritance Test4.017.03.412.23.714.6
Indexing Test4.619.04.516.94.618.0
Graph (Binary Tree) Test1.56.61.67.81.67.2
Multithreading Test5.224.15.213.55.218.8
All Tests3.716.53.211.33.413.9

The results above show that in general Hibernate with HSQLDB embedded is much more efficient than Hibernate with H2 server in performing JPA database operations. Comparing the normalized speed of Hibernate with H2 database server (3.4) to the normalized speed of Hibernate with HSQLDB embedded database (13.9) reveals that in these tests, Hibernate with HSQLDB embedded is 4.1 times faster than Hibernate with H2 server.

A large performance gap has been detected when using JPA element collections with large transaction/retrieval size. Comparing the normalized speed of Hibernate with H2 database server (1.0) to the normalized speed of Hibernate with HSQLDB embedded database (6.3) reveals that in that case, Hibernate with HSQLDB embedded is 6.3 times faster than Hibernate with H2 server.

Other Head to Head DBMS/JPA Comparisons

Hibernate with H2 server against:

  • Oracle Database 11g
  • IBM DB2 10
  • Microsoft SQL Server 2008
  • DataNucleus with Derby embedded
  • DataNucleus with H2 embedded
  • DataNucleus with HSQLDB embedded
  • DataNucleus with DB4O embedded
  • DataNucleus with Derby server
  • DataNucleus with H2 server
  • DataNucleus with MySQL server
  • DataNucleus with PostgreSQL server
  • EclipseLink with Derby embedded
  • EclipseLink with H2 embedded
  • EclipseLink with HSQLDB embedded
  • EclipseLink with SQLite embedded
  • EclipseLink with Derby server
  • EclipseLink with H2 server
  • EclipseLink with MySQL server
  • EclipseLink with PostgreSQL server
  • Hibernate with Derby embedded
  • Hibernate with H2 embedded
  • Hibernate with HSQLDB embedded
  • Hibernate with SQLite embedded
  • Hibernate with Derby server
  • Hibernate with MySQL server
  • Hibernate with PostgreSQL server
  • OpenJPA with Derby embedded
  • OpenJPA with H2 embedded
  • OpenJPA with HSQLDB embedded
  • OpenJPA with Derby server
  • OpenJPA with H2 server
  • OpenJPA with MySQL server
  • OpenJPA with PostgreSQL server
  • ObjectDB embedded
  • ObjectDB server

Hibernate with HSQLDB embedded against:

  • Oracle Database 11g
  • IBM DB2 10
  • Microsoft SQL Server 2008
  • DataNucleus with Derby embedded
  • DataNucleus with H2 embedded
  • DataNucleus with HSQLDB embedded
  • DataNucleus with DB4O embedded
  • DataNucleus with Derby server
  • DataNucleus with H2 server
  • DataNucleus with MySQL server
  • DataNucleus with PostgreSQL server
  • EclipseLink with Derby embedded
  • EclipseLink with H2 embedded
  • EclipseLink with HSQLDB embedded
  • EclipseLink with SQLite embedded
  • EclipseLink with Derby server
  • EclipseLink with H2 server
  • EclipseLink with MySQL server
  • EclipseLink with PostgreSQL server
  • Hibernate with Derby embedded
  • Hibernate with H2 embedded
  • Hibernate with SQLite embedded
  • Hibernate with Derby server
  • Hibernate with H2 server
  • Hibernate with MySQL server
  • Hibernate with PostgreSQL server
  • OpenJPA with Derby embedded
  • OpenJPA with H2 embedded
  • OpenJPA with HSQLDB embedded
  • OpenJPA with Derby server
  • OpenJPA with H2 server
  • OpenJPA with MySQL server
  • OpenJPA with PostgreSQL server
  • ObjectDB embedded
  • ObjectDB server

Từ khóa » H2 Vs Hsqldb