Compare with

Comparison of Hibernate with H2 embedded vs Hibernate with HSQLDB server

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
 Hibernate
H2 embedded
Hibernate
HSQLDB server
Hibernate
H2 embedded
Hibernate
HSQLDB server
Hibernate
H2 embedded
Hibernate
HSQLDB server
Basic Person Test8.9stopped9.3stopped9.1stopped
Element Collection Test11.5stopped7.6stopped9.5stopped
Inheritance Test6.8stopped9.4stopped8.1stopped
Indexing Test12.5stopped12.3stopped12.4stopped
Graph (Binary Tree) Test7.7stopped8.5stopped8.1stopped
Multithreading Test9.8stopped0.0000stopped4.9stopped
All Tests9.5stopped7.8stopped8.7stopped

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
Hibernate
HSQLDB server
Hibernate
H2 embedded
Hibernate
HSQLDB server
Hibernate
H2 embedded
Hibernate
HSQLDB server
Basic Person Test5.2stopped12.7stopped8.9stopped
Element Collection Test3.8stopped3.9stopped3.9stopped
Inheritance Test9.4stopped18.4stopped13.9stopped
Indexing Test9.1stopped13.2stopped11.1stopped
Graph (Binary Tree) Test1.5stopped3.4stopped2.5stopped
Multithreading Test10.7stopped16.4stopped13.6stopped
All Tests6.6stopped11.3stopped9.0stopped

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
Hibernate
HSQLDB server
Hibernate
H2 embedded
Hibernate
HSQLDB server
Hibernate
H2 embedded
Hibernate
HSQLDB server
Basic Person Test3.0stopped5.5stopped4.2stopped
Element Collection Test4.4stopped3.3stopped3.9stopped
Inheritance Test1.7stopped5.6stopped3.7stopped
Indexing Test4.7stopped6.4stopped5.5stopped
Multithreading Test2.0stopped5.9stopped4.0stopped
All Tests3.2stopped5.4stopped4.3stopped

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

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
Hibernate
HSQLDB server
Hibernate
H2 embedded
Hibernate
HSQLDB server
Hibernate
H2 embedded
Hibernate
HSQLDB server
Basic Person Test10.6stopped10.1stopped10.4stopped
Element Collection Test16.7stopped5.9stopped11.3stopped
Inheritance Test10.9stopped14.6stopped12.8stopped
Indexing Test24.0stopped12.3stopped18.2stopped
Graph (Binary Tree) Test5.8stopped4.0stopped4.9stopped
Multithreading Test7.0stopped5.1stopped6.1stopped
All Tests12.5stopped8.7stopped10.6stopped

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

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
Hibernate
HSQLDB server
Hibernate
H2 embedded
Hibernate
HSQLDB server
Hibernate
H2 embedded
Hibernate
HSQLDB server
Basic Person Test31.2stopped23.7stopped27.5stopped
Element Collection Test22.7stopped3.1stopped12.9stopped
Inheritance Test41.4stopped18.0stopped29.7stopped
Indexing Test66.1stopped14.2stopped40.1stopped
Graph (Binary Tree) Test16.7stopped22.4stopped19.6stopped
Multithreading Test20.4stopped0.0000stopped10.2stopped
All Tests33.1stopped13.6stopped23.3stopped

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

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
Hibernate
HSQLDB server
Hibernate
H2 embedded
Hibernate
HSQLDB server
Hibernate
H2 embedded
Hibernate
HSQLDB server
Basic Person Test11.8stopped12.3stopped12.0stopped
Element Collection Test11.8stopped4.8stopped8.3stopped
Inheritance Test14.1stopped13.2stopped13.6stopped
Indexing Test23.3stopped11.7stopped17.5stopped
Graph (Binary Tree) Test7.9stopped9.6stopped8.8stopped
Multithreading Test10.0stopped5.5stopped7.8stopped
All Tests13.3stopped9.5stopped11.4stopped

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

A huge performance gap has been detected when using simple basic entities with small transaction/retrieval size. Comparing the normalized speed of Hibernate with HSQLDB database server (0.0000) to the normalized speed of Hibernate with H2 embedded database (11.8) reveals that in that case, Hibernate with H2 embedded is ? times faster than Hibernate with HSQLDB server.

Other Head to Head DBMS/JPA Comparisons