Compare with

Comparison of DataNucleus with H2 embedded vs Hibernate with PostgreSQL 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
 DataNucleus
H2 embedded
Hibernate
PostgreSQL server
DataNucleus
H2 embedded
Hibernate
PostgreSQL server
DataNucleus
H2 embedded
Hibernate
PostgreSQL server
Basic Person Test19.27.18.03.413.65.2
Element Collection Test6.62.92.81.74.72.3
Inheritance Test15.67.04.43.610.05.3
Indexing Test24.49.311.86.118.17.7
Graph (Binary Tree) Test9.23.06.22.97.72.9
Multithreading Test34.931.77.113.921.022.8
All Tests18.310.26.75.312.57.7

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

A large performance gap has been detected when using graphs of objects with small transaction size. Comparing the normalized speed of Hibernate with PostgreSQL database server (3.0) to the normalized speed of DataNucleus with H2 embedded database (9.2) reveals that in that case, DataNucleus with H2 embedded is 3.1 times faster than Hibernate with PostgreSQL server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 DataNucleus
H2 embedded
Hibernate
PostgreSQL server
DataNucleus
H2 embedded
Hibernate
PostgreSQL server
DataNucleus
H2 embedded
Hibernate
PostgreSQL server
Basic Person Test13.25.513.511.513.38.5
Element Collection Test6.40.0258.90.0177.70.021
Inheritance Test12.25.212.714.012.49.6
Indexing Test8.14.616.513.312.38.9
Graph (Binary Tree) Test10.60.6120.90.7815.80.70
Multithreading Test13.311.39.917.011.614.2
All Tests10.64.513.79.412.27.0

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

A huge performance gap has been detected when using JPA element collections with large retrieval size. Comparing the normalized speed of Hibernate with PostgreSQL database server (0.017) to the normalized speed of DataNucleus with H2 embedded database (8.9) reveals that in that case, DataNucleus with H2 embedded is 524 times faster than Hibernate with PostgreSQL server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 DataNucleus
H2 embedded
Hibernate
PostgreSQL server
DataNucleus
H2 embedded
Hibernate
PostgreSQL server
DataNucleus
H2 embedded
Hibernate
PostgreSQL server
Basic Person Test4.755.51.46.13.130.8
Element Collection Test5.011.02.40.0163.75.5
Inheritance Test3.852.31.68.72.730.5
Indexing Test0.00410.0501.88.80.914.4
Multithreading Test1.255.20.799.21.032.2
All Tests3.034.81.66.62.320.7

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

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

On the other hand, Hibernate with PostgreSQL server is slower, for instance, when using JPA element collections with large retrieval size. Comparing the normalized speed of Hibernate with PostgreSQL database server (0.016) to the normalized speed of DataNucleus with H2 embedded database (2.4) reveals that in that case, Hibernate with PostgreSQL server is 150 times slower than DataNucleus with H2 embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 DataNucleus
H2 embedded
Hibernate
PostgreSQL server
DataNucleus
H2 embedded
Hibernate
PostgreSQL server
DataNucleus
H2 embedded
Hibernate
PostgreSQL server
Basic Person Test10.05.33.92.76.94.0
Element Collection Test7.60.0673.90.0265.80.046
Inheritance Test9.45.44.43.86.94.6
Indexing Test10.65.45.94.38.24.8
Graph (Binary Tree) Test5.91.13.70.584.80.82
Multithreading Testfailed29.6failed6.3failed18.0
All Tests8.77.84.42.96.55.4

DataNucleus with H2 embedded has failed in 2 tests (see exceptions).

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

A huge performance gap has been detected when using JPA element collections with large transaction size. Comparing the normalized speed of Hibernate with PostgreSQL database server (0.026) to the normalized speed of DataNucleus with H2 embedded database (3.9) reveals that in that case, DataNucleus with H2 embedded is 150 times faster than Hibernate with PostgreSQL server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 DataNucleus
H2 embedded
Hibernate
PostgreSQL server
DataNucleus
H2 embedded
Hibernate
PostgreSQL server
DataNucleus
H2 embedded
Hibernate
PostgreSQL server
Basic Person Test4.25.31.34.22.84.8
Element Collection Test4.90.0201.6stopped3.20.0098
Inheritance Test4.05.11.34.22.74.6
Indexing Test7.59.51.96.34.77.9
Graph (Binary Tree) Test5.60.0124.10.0124.80.012
Multithreading Testfailed23.3failed21.8failed22.5
All Tests5.27.22.06.13.66.6

DataNucleus with H2 embedded has failed in 2 tests (see exceptions).

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

A large performance gap has been detected when using database indexes with large transaction size. Comparing the normalized speed of DataNucleus with H2 embedded database (1.9) to the normalized speed of Hibernate with PostgreSQL database server (6.3) reveals that in that case, Hibernate with PostgreSQL server is 3.3 times faster than DataNucleus with H2 embedded.

On the other hand, Hibernate with PostgreSQL server is slower, for instance, when using graphs of objects with small transaction size. Comparing the normalized speed of Hibernate with PostgreSQL database server (0.012) to the normalized speed of DataNucleus with H2 embedded database (5.6) reveals that in that case, Hibernate with PostgreSQL server is 467 times slower than DataNucleus with H2 embedded.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 DataNucleus
H2 embedded
Hibernate
PostgreSQL server
DataNucleus
H2 embedded
Hibernate
PostgreSQL server
DataNucleus
H2 embedded
Hibernate
PostgreSQL server
Basic Person Test10.315.75.65.67.910.7
Element Collection Test6.12.83.90.355.01.6
Inheritance Test9.015.04.96.96.910.9
Indexing Test10.15.87.67.88.96.8
Graph (Binary Tree) Test7.81.28.71.18.31.1
Multithreading Test16.530.25.913.611.221.9
All Tests9.612.16.06.07.89.1

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

A large performance gap has been detected when using multithreading with large transaction/retrieval size. Comparing the normalized speed of DataNucleus with H2 embedded database (5.9) to the normalized speed of Hibernate with PostgreSQL database server (13.6) reveals that in that case, Hibernate with PostgreSQL server is 2.3 times faster than DataNucleus with H2 embedded.

On the other hand, Hibernate with PostgreSQL server is slower, for instance, when using JPA element collections with large transaction/retrieval size. Comparing the normalized speed of Hibernate with PostgreSQL database server (0.35) to the normalized speed of DataNucleus with H2 embedded database (3.9) reveals that in that case, Hibernate with PostgreSQL server is 11.1 times slower than DataNucleus with H2 embedded.

Other Head to Head DBMS/JPA Comparisons