Compare with

Comparison of Hibernate with Derby embedded vs Hibernate with H2 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
Derby embedded
Hibernate
H2 server
Hibernate
Derby embedded
Hibernate
H2 server
Hibernate
Derby embedded
Hibernate
H2 server
Basic Person Test5.94.63.83.04.93.8
Element Collection Test2.93.71.81.12.32.4
Inheritance Test5.36.73.73.14.54.9
Indexing Test7.08.24.84.25.96.2
Graph (Binary Tree) Test1.93.41.73.91.83.7
Multithreading Test10.56.83.75.07.15.9
All Tests5.65.63.33.44.44.5

The results above show that in general Hibernate with H2 server is slightly more efficient than Hibernate with Derby embedded in persisting JPA entity objects to the database.

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby embedded
Hibernate
H2 server
Hibernate
Derby embedded
Hibernate
H2 server
Hibernate
Derby embedded
Hibernate
H2 server
Basic Person Test14.23.116.46.015.34.6
Element Collection Test4.41.04.91.14.61.0
Inheritance Test10.32.918.67.614.45.2
Indexing Test10.02.616.47.013.24.8
Graph (Binary Tree) Test2.60.423.01.12.80.78
Multithreading Test19.36.519.310.519.38.5
All Tests10.12.813.15.611.64.2

The results above show that in general Hibernate with Derby embedded is 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 Derby embedded database (11.6) reveals that in these tests, Hibernate with Derby embedded is 2.8 times faster than Hibernate with H2 server.

A large performance gap has been detected when using graphs of objects with small retrieval size. Comparing the normalized speed of Hibernate with H2 database server (0.42) to the normalized speed of Hibernate with Derby embedded database (2.6) reveals that in that case, Hibernate with Derby embedded is 6.2 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
 Hibernate
Derby embedded
Hibernate
H2 server
Hibernate
Derby embedded
Hibernate
H2 server
Hibernate
Derby embedded
Hibernate
H2 server
Basic Person Test49.33.76.81.028.12.3
Element Collection Test37.63.72.70.6320.12.2
Inheritance Test24.13.27.61.415.92.3
Indexing Test5.31.714.85.810.13.8
Multithreading Test39.71.16.10.8822.91.0
All Tests31.22.77.61.919.42.3

The results above show that in general Hibernate with Derby embedded is much 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 Derby embedded database (19.4) reveals that in these tests, Hibernate with Derby embedded is 8.4 times faster than Hibernate with H2 server.

A huge performance gap has been detected when using multithreading with small retrieval size. Comparing the normalized speed of Hibernate with H2 database server (1.1) to the normalized speed of Hibernate with Derby embedded database (39.7) reveals that in that case, Hibernate with Derby embedded is 36.1 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
 Hibernate
Derby embedded
Hibernate
H2 server
Hibernate
Derby embedded
Hibernate
H2 server
Hibernate
Derby embedded
Hibernate
H2 server
Basic Person Test4.52.93.21.83.82.4
Element Collection Test3.92.63.11.13.51.9
Inheritance Test4.63.24.52.54.52.9
Indexing Test4.62.95.52.75.12.8
Graph (Binary Tree) Test2.71.21.20.432.00.79
Multithreading Test11.65.62.62.47.14.0
All Tests5.33.13.31.84.32.5

The results above show that in general Hibernate with Derby embedded is more efficient than Hibernate with H2 server in updating JPA entity objects in the database.

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 Derby embedded database (3.1) reveals that in that case, Hibernate with Derby embedded is 2.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
 Hibernate
Derby embedded
Hibernate
H2 server
Hibernate
Derby embedded
Hibernate
H2 server
Hibernate
Derby embedded
Hibernate
H2 server
Basic Person Test3.83.84.22.44.03.1
Element Collection Test2.31.91.51.11.91.5
Inheritance Test4.03.74.32.54.23.1
Indexing Test5.57.63.63.14.65.3
Graph (Binary Tree) Test0.740.990.960.910.850.95
Multithreading Test5.66.14.97.35.36.7
All Tests3.74.03.32.93.53.5

The results above show that in general Hibernate with Derby embedded is equivalent to Hibernate with H2 server in deleting JPA entity objects from the database.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
Derby embedded
Hibernate
H2 server
Hibernate
Derby embedded
Hibernate
H2 server
Hibernate
Derby embedded
Hibernate
H2 server
Basic Person Test15.53.66.92.811.23.2
Element Collection Test10.22.62.81.06.51.8
Inheritance Test9.74.07.73.48.73.7
Indexing Test6.54.69.04.57.84.6
Graph (Binary Tree) Test2.01.51.71.61.81.6
Multithreading Test17.35.27.35.212.35.2
All Tests10.53.76.13.28.33.4

The results above show that in general Hibernate with Derby embedded is 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 Derby embedded database (8.3) reveals that in these tests, Hibernate with Derby embedded is 2.4 times faster than Hibernate with H2 server.

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

Other Head to Head DBMS/JPA Comparisons