Compare with

Comparison of Hibernate with H2 embedded vs DataNucleus 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
 Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Basic Person Test18.14.19.02.613.53.3
Element Collection Test13.00.916.80.389.90.64
Inheritance Test21.03.89.42.415.23.1
Indexing Test29.96.018.46.424.16.2
Graph (Binary Tree) Test17.20.9120.10.7718.70.84
Multithreading Test36.918.011.58.324.213.1
All Tests22.65.612.53.517.64.5

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
 Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Basic Person Test16.61.713.37.615.04.6
Element Collection Test4.30.734.00.634.10.68
Inheritance Test10.41.517.59.313.95.4
Indexing Test10.81.515.29.213.05.3
Graph (Binary Tree) Test2.52.64.012.33.37.4
Multithreading Test16.23.415.710.815.97.1
All Tests10.11.911.68.310.95.1

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
 Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Basic Person Test4.549.11.24.72.826.9
Element Collection Test4.439.11.40.482.919.8
Inheritance Test3.155.91.56.62.331.2
Indexing Test6.60.04810.56.48.63.2
Multithreading Test1.2failed0.59failed0.89failed
All Tests4.036.03.04.53.520.3

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
 Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Basic Person Test12.12.16.50.849.31.5
Element Collection Test7.41.45.30.646.31.0
Inheritance Test10.82.18.51.29.61.7
Indexing Test10.02.27.51.58.81.8
Graph (Binary Tree) Test4.40.652.30.203.40.42
Multithreading Test16.20.464.0failed10.10.46
All Tests10.11.55.70.877.91.2

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
 Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Basic Person Test19.73.011.41.315.52.2
Element Collection Test6.91.04.50.395.70.69
Inheritance Test15.62.812.91.314.22.1
Indexing Test23.25.412.41.917.83.7
Graph (Binary Tree) Test4.00.384.20.374.10.37
Multithreading Test27.413.822.7failed25.013.8
All Tests16.14.411.41.113.72.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 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
 Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Hibernate
H2 embedded
DataNucleus
PostgreSQL server
Basic Person Test14.212.08.33.411.27.7
Element Collection Test7.28.64.40.505.84.6
Inheritance Test12.213.29.94.211.08.7
Indexing Test16.13.012.85.114.54.0
Graph (Binary Tree) Test7.01.17.73.47.32.3
Multithreading Test19.68.910.99.515.29.1
All Tests12.98.09.03.811.06.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