Compare with

Comparison of DataNucleus with PostgreSQL server vs Hibernate with H2 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
 DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
Basic Person Test4.118.12.69.03.313.5
Element Collection Test0.9113.00.386.80.649.9
Inheritance Test3.821.02.49.43.115.2
Indexing Test6.029.96.418.46.224.1
Graph (Binary Tree) Test0.9117.20.7720.10.8418.7
Multithreading Test18.036.98.311.513.124.2
All Tests5.622.63.512.54.517.6

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

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
Basic Person Test1.716.67.613.34.615.0
Element Collection Test0.734.30.634.00.684.1
Inheritance Test1.510.49.317.55.413.9
Indexing Test1.510.89.215.25.313.0
Graph (Binary Tree) Test2.62.512.34.07.43.3
Multithreading Test3.416.210.815.77.115.9
All Tests1.910.18.311.65.110.9

The results above show that in general Hibernate with H2 embedded is more efficient than DataNucleus with PostgreSQL server in retrieving JPA entity objects from the database. Comparing the normalized speed of DataNucleus with PostgreSQL database server (5.1) to the normalized speed of Hibernate with H2 embedded database (10.9) reveals that in these tests, Hibernate with H2 embedded is 2.1 times faster than DataNucleus with PostgreSQL server.

A large performance gap has been detected when using simple basic entities with small retrieval size. Comparing the normalized speed of DataNucleus with PostgreSQL database server (1.7) to the normalized speed of Hibernate with H2 embedded database (16.6) reveals that in that case, Hibernate with H2 embedded is 9.8 times faster than DataNucleus with PostgreSQL server.

On the other hand, Hibernate with H2 embedded is slower, for instance, when using graphs of objects with large retrieval size. Comparing the normalized speed of Hibernate with H2 embedded database (4.0) to the normalized speed of DataNucleus with PostgreSQL database server (12.3) reveals that in that case, Hibernate with H2 embedded is 3.1 times slower than DataNucleus with PostgreSQL server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
Basic Person Test49.14.54.71.226.92.8
Element Collection Test39.14.40.481.419.82.9
Inheritance Test55.93.16.61.531.22.3
Indexing Test0.0486.66.410.53.28.6
Multithreading Testfailed1.2failed0.59failed0.89
All Tests36.04.04.53.020.33.5

DataNucleus with PostgreSQL server has failed in 2 tests (see exceptions).

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

A huge performance gap has been detected when using class inheritance in the object model with small retrieval size. Comparing the normalized speed of Hibernate with H2 embedded database (3.1) to the normalized speed of DataNucleus with PostgreSQL database server (55.9) reveals that in that case, DataNucleus with PostgreSQL server is 18.0 times faster than Hibernate with H2 embedded.

On the other hand, DataNucleus with PostgreSQL server is slower, for instance, when using database indexes with small retrieval size. Comparing the normalized speed of DataNucleus with PostgreSQL database server (0.048) to the normalized speed of Hibernate with H2 embedded database (6.6) reveals that in that case, DataNucleus with PostgreSQL server is 138 times slower than Hibernate with H2 embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
Basic Person Test2.112.10.846.51.59.3
Element Collection Test1.47.40.645.31.06.3
Inheritance Test2.110.81.28.51.79.6
Indexing Test2.210.01.57.51.88.8
Graph (Binary Tree) Test0.654.40.202.30.423.4
Multithreading Test0.4616.2failed4.00.4610.1
All Tests1.510.10.875.71.27.9

DataNucleus with PostgreSQL server has failed in 1 tests (see exceptions).

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

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

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
Basic Person Test3.019.71.311.42.215.5
Element Collection Test1.06.90.394.50.695.7
Inheritance Test2.815.61.312.92.114.2
Indexing Test5.423.21.912.43.717.8
Graph (Binary Tree) Test0.384.00.374.20.374.1
Multithreading Test13.827.4failed22.713.825.0
All Tests4.416.11.111.42.913.7

DataNucleus with PostgreSQL server has failed in 1 tests (see exceptions).

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

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

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
Basic Person Test12.014.23.48.37.711.2
Element Collection Test8.67.20.504.44.65.8
Inheritance Test13.212.24.29.98.711.0
Indexing Test3.016.15.112.84.014.5
Graph (Binary Tree) Test1.17.03.47.72.37.3
Multithreading Test8.919.69.510.99.115.2
All Tests8.012.93.89.06.011.0

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

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

Other Head to Head DBMS/JPA Comparisons