Compare with

Comparison of Hibernate with H2 server 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 server
DataNucleus
PostgreSQL server
Hibernate
H2 server
DataNucleus
PostgreSQL server
Hibernate
H2 server
DataNucleus
PostgreSQL server
Basic Person Test4.64.13.02.63.83.3
Element Collection Test3.70.911.10.382.40.64
Inheritance Test6.73.83.12.44.93.1
Indexing Test8.26.04.26.46.26.2
Graph (Binary Tree) Test3.40.913.90.773.70.84
Multithreading Test6.818.05.08.35.913.1
All Tests5.65.63.43.54.54.5

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

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

On the other hand, DataNucleus with PostgreSQL server is slower, for instance, 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 database server (3.9) reveals that in that case, DataNucleus with PostgreSQL server is 5.1 times slower than Hibernate with H2 server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 server
DataNucleus
PostgreSQL server
Hibernate
H2 server
DataNucleus
PostgreSQL server
Hibernate
H2 server
DataNucleus
PostgreSQL server
Basic Person Test3.11.76.07.64.64.6
Element Collection Test1.00.731.10.631.00.68
Inheritance Test2.91.57.69.35.25.4
Indexing Test2.61.57.09.24.85.3
Graph (Binary Tree) Test0.422.61.112.30.787.4
Multithreading Test6.53.410.510.88.57.1
All Tests2.81.95.68.34.25.1

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

A huge performance gap has been detected when using graphs of objects with large retrieval size. Comparing the normalized speed of Hibernate with H2 database server (1.1) to the normalized speed of DataNucleus with PostgreSQL database server (12.3) reveals that in that case, DataNucleus with PostgreSQL server is 11.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
H2 server
DataNucleus
PostgreSQL server
Hibernate
H2 server
DataNucleus
PostgreSQL server
Hibernate
H2 server
DataNucleus
PostgreSQL server
Basic Person Test3.749.11.04.72.326.9
Element Collection Test3.739.10.630.482.219.8
Inheritance Test3.255.91.46.62.331.2
Indexing Test1.70.0485.86.43.83.2
Multithreading Test1.1failed0.88failed1.0failed
All Tests2.736.01.94.52.320.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 server in executing the tested JPA queries. Comparing the normalized speed of Hibernate with H2 database server (2.3) to the normalized speed of DataNucleus with PostgreSQL database server (20.3) reveals that in these tests, DataNucleus with PostgreSQL server is 8.8 times faster than Hibernate with H2 server.

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 database server (3.2) to the normalized speed of DataNucleus with PostgreSQL database server (55.9) reveals that in that case, DataNucleus with PostgreSQL server is 17.5 times faster than Hibernate with H2 server.

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 database server (1.7) reveals that in that case, DataNucleus with PostgreSQL server is 35.4 times slower than Hibernate with H2 server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 server
DataNucleus
PostgreSQL server
Hibernate
H2 server
DataNucleus
PostgreSQL server
Hibernate
H2 server
DataNucleus
PostgreSQL server
Basic Person Test2.92.11.80.842.41.5
Element Collection Test2.61.41.10.641.91.0
Inheritance Test3.22.12.51.22.91.7
Indexing Test2.92.22.71.52.81.8
Graph (Binary Tree) Test1.20.650.430.200.790.42
Multithreading Test5.60.462.4failed4.00.46
All Tests3.11.51.80.872.51.2

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

The results above show that in general Hibernate with H2 server is 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 database server (2.5) reveals that in these tests, Hibernate with H2 server is 2.1 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 database server (5.6) reveals that in that case, Hibernate with H2 server is 12.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 server
DataNucleus
PostgreSQL server
Hibernate
H2 server
DataNucleus
PostgreSQL server
Hibernate
H2 server
DataNucleus
PostgreSQL server
Basic Person Test3.83.02.41.33.12.2
Element Collection Test1.91.01.10.391.50.69
Inheritance Test3.72.82.51.33.12.1
Indexing Test7.65.43.11.95.33.7
Graph (Binary Tree) Test0.990.380.910.370.950.37
Multithreading Test6.113.87.3failed6.713.8
All Tests4.04.42.91.13.52.9

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

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

A large 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 database server (1.1) reveals that in that case, Hibernate with H2 server is 2.8 times faster than DataNucleus with PostgreSQL server.

On the other hand, Hibernate with H2 server is slower, for instance, when using multithreading with small transaction size. Comparing the normalized speed of Hibernate with H2 database server (6.1) to the normalized speed of DataNucleus with PostgreSQL database server (13.8) reveals that in that case, Hibernate with H2 server is 2.3 times slower 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 server
DataNucleus
PostgreSQL server
Hibernate
H2 server
DataNucleus
PostgreSQL server
Hibernate
H2 server
DataNucleus
PostgreSQL server
Basic Person Test3.612.02.83.43.27.7
Element Collection Test2.68.61.00.501.84.6
Inheritance Test4.013.23.44.23.78.7
Indexing Test4.63.04.55.14.64.0
Graph (Binary Tree) Test1.51.11.63.41.62.3
Multithreading Test5.28.95.29.55.29.1
All Tests3.78.03.23.83.46.0

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

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

On the other hand, DataNucleus with PostgreSQL server is slower, for instance, 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 database server (1.0) reveals that in that case, DataNucleus with PostgreSQL server is 2.0 times slower than Hibernate with H2 server.

Other Head to Head DBMS/JPA Comparisons