Compare with

Comparison of Hibernate with Derby server 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 server
Hibernate
H2 server
Hibernate
Derby server
Hibernate
H2 server
Hibernate
Derby server
Hibernate
H2 server
Basic Person Test3.84.63.03.03.43.8
Element Collection Test2.03.71.31.11.72.4
Inheritance Test3.46.73.03.13.24.9
Indexing Test4.88.24.14.24.46.2
Graph (Binary Tree) Test1.83.41.63.91.73.7
Multithreading Test6.96.83.95.05.45.9
All Tests3.85.62.83.43.34.5

The results above show that in general Hibernate with H2 server is more efficient than Hibernate with Derby server 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 database server (1.6) to the normalized speed of Hibernate with H2 database server (3.9) reveals that in that case, Hibernate with H2 server is 2.4 times faster than Hibernate with Derby server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby server
Hibernate
H2 server
Hibernate
Derby server
Hibernate
H2 server
Hibernate
Derby server
Hibernate
H2 server
Basic Person Test3.83.18.46.06.14.6
Element Collection Test1.01.01.01.11.01.0
Inheritance Test3.52.99.77.66.65.2
Indexing Test3.22.69.57.06.44.8
Graph (Binary Tree) Test0.910.421.21.11.10.78
Multithreading Test7.86.513.410.510.68.5
All Tests3.42.87.25.65.34.2

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

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 database server (0.91) reveals that in that case, Hibernate with Derby server is 2.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 server
Hibernate
H2 server
Hibernate
Derby server
Hibernate
H2 server
Hibernate
Derby server
Hibernate
H2 server
Basic Person Test34.03.74.11.019.12.3
Element Collection Test33.83.70.640.6317.22.2
Inheritance Test20.53.25.01.412.82.3
Indexing Test2.01.79.25.85.63.8
Multithreading Test36.21.15.10.8820.61.0
All Tests25.32.74.81.915.12.3

The results above show that in general Hibernate with Derby server 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 database server (15.1) reveals that in these tests, Hibernate with Derby server is 6.6 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 database server (36.2) reveals that in that case, Hibernate with Derby server is 32.9 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 server
Hibernate
H2 server
Hibernate
Derby server
Hibernate
H2 server
Hibernate
Derby server
Hibernate
H2 server
Basic Person Test2.92.92.51.82.72.4
Element Collection Test2.32.61.51.11.91.9
Inheritance Test2.93.23.52.53.22.9
Indexing Test3.02.94.22.73.62.8
Graph (Binary Tree) Test1.21.20.580.430.910.79
Multithreading Test6.85.62.52.44.64.0
All Tests3.23.12.51.82.82.5

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

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby server
Hibernate
H2 server
Hibernate
Derby server
Hibernate
H2 server
Hibernate
Derby server
Hibernate
H2 server
Basic Person Test2.93.83.52.43.23.1
Element Collection Test1.71.90.871.11.31.5
Inheritance Test2.93.73.62.53.23.1
Indexing Test3.77.63.63.13.75.3
Graph (Binary Tree) Test0.690.990.700.910.700.95
Multithreading Test6.26.15.17.35.66.7
All Tests3.04.02.92.93.03.5

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

A large performance gap has been detected when using database indexes with small transaction size. Comparing the normalized speed of Hibernate with Derby database server (3.7) to the normalized speed of Hibernate with H2 database server (7.6) reveals that in that case, Hibernate with H2 server is 2.1 times faster than Hibernate with Derby server.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
Derby server
Hibernate
H2 server
Hibernate
Derby server
Hibernate
H2 server
Hibernate
Derby server
Hibernate
H2 server
Basic Person Test9.53.64.32.86.93.2
Element Collection Test8.22.61.11.04.61.8
Inheritance Test6.64.05.03.45.83.7
Indexing Test3.34.66.14.54.74.6
Graph (Binary Tree) Test1.21.51.01.61.11.6
Multithreading Test12.85.26.05.29.45.2
All Tests7.13.74.03.25.63.4

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

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

Other Head to Head DBMS/JPA Comparisons