Compare with

Comparison of Hibernate with H2 embedded vs Hibernate with Derby 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
 Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Basic Person Test18.15.99.03.813.54.9
Element Collection Test13.02.96.81.89.92.3
Inheritance Test21.05.39.43.715.24.5
Indexing Test29.97.018.44.824.15.9
Graph (Binary Tree) Test17.21.920.11.718.71.8
Multithreading Test36.910.511.53.724.27.1
All Tests22.65.612.53.317.64.4

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

A huge 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 embedded database (20.1) reveals that in that case, Hibernate with H2 embedded is 11.8 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
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Basic Person Test16.614.213.316.415.015.3
Element Collection Test4.34.44.04.94.14.6
Inheritance Test10.410.317.518.613.914.4
Indexing Test10.810.015.216.413.013.2
Graph (Binary Tree) Test2.52.64.03.03.32.8
Multithreading Test16.219.315.719.315.919.3
All Tests10.110.111.613.110.911.6

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Basic Person Test4.549.31.26.82.828.1
Element Collection Test4.437.61.42.72.920.1
Inheritance Test3.124.11.57.62.315.9
Indexing Test6.65.310.514.88.610.1
Multithreading Test1.239.70.596.10.8922.9
All Tests4.031.23.07.63.519.4

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

A huge performance gap has been detected when using multithreading with small retrieval size. Comparing the normalized speed of Hibernate with H2 embedded database (1.2) to the normalized speed of Hibernate with Derby embedded database (39.7) reveals that in that case, Hibernate with Derby embedded is 33.1 times faster than Hibernate with H2 embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Basic Person Test12.14.56.53.29.33.8
Element Collection Test7.43.95.33.16.33.5
Inheritance Test10.84.68.54.59.64.5
Indexing Test10.04.67.55.58.85.1
Graph (Binary Tree) Test4.42.72.31.23.42.0
Multithreading Test16.211.64.02.610.17.1
All Tests10.15.35.73.37.94.3

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

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

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Basic Person Test19.73.811.44.215.54.0
Element Collection Test6.92.34.51.55.71.9
Inheritance Test15.64.012.94.314.24.2
Indexing Test23.25.512.43.617.84.6
Graph (Binary Tree) Test4.00.744.20.964.10.85
Multithreading Test27.45.622.74.925.05.3
All Tests16.13.711.43.313.73.5

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

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

Comparison of database storage efficiency (normalized score, higher is better)

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Basic Person Test27.052.727.052.727.052.7
Element Collection Test30.642.330.642.330.642.3
Inheritance Test27.049.227.049.227.049.2
Indexing Test31.653.032.153.931.953.4
Graph (Binary Tree) Test28.513.121.49.825.011.5
Multithreading Test33.949.39.28.821.529.0
All Tests29.843.324.636.127.239.7

The results above show that in general Hibernate with Derby embedded is more efficient than Hibernate with H2 embedded in using disk space.

On the other hand, Hibernate with Derby embedded is slower, for instance, when using graphs of objects with large transaction size. Comparing the normalized score of Hibernate with Derby embedded database (9.8) to the normalized score of Hibernate with H2 embedded database (21.4) reveals that in that case, Hibernate with Derby embedded is 2.2 times less efficient than Hibernate with H2 embedded.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Basic Person Test14.215.58.36.911.211.2
Element Collection Test7.210.24.42.85.86.5
Inheritance Test12.29.79.97.711.08.7
Indexing Test16.16.512.89.014.57.8
Graph (Binary Tree) Test7.02.07.71.77.31.8
Multithreading Test19.617.310.97.315.212.3
All Tests12.910.59.06.111.08.3

The results above show that in general Hibernate with H2 embedded is more efficient than Hibernate with Derby embedded in performing JPA database operations.

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

Other Head to Head DBMS/JPA Comparisons