Compare with

Comparison of OpenJPA 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
 OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
Basic Person Test17.14.15.82.611.53.3
Element Collection Test10.90.914.90.387.90.64
Inheritance Test14.33.85.92.410.13.1
Indexing Test24.46.013.76.419.16.2
Graph (Binary Tree) Test6.80.916.70.776.70.84
Multithreading Test34.218.010.28.322.213.1
All Tests17.95.67.93.512.94.5

The results above show that in general OpenJPA with H2 embedded is 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 OpenJPA with H2 embedded database (12.9) reveals that in these tests, OpenJPA with H2 embedded is 2.9 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.38) to the normalized speed of OpenJPA with H2 embedded database (4.9) reveals that in that case, OpenJPA with H2 embedded is 12.9 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
 OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
Basic Person Test14.61.727.27.620.94.6
Element Collection Test0.00460.734.30.632.10.68
Inheritance Test0.0111.57.49.33.75.4
Indexing Test17.01.535.09.226.05.3
Graph (Binary Tree) Test1.02.61.412.31.27.4
Multithreading Test18.73.427.610.823.17.1
All Tests8.61.917.18.312.85.1

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

A huge performance gap has been detected when using database indexes with small retrieval size. Comparing the normalized speed of DataNucleus with PostgreSQL database server (1.5) to the normalized speed of OpenJPA with H2 embedded database (17.0) reveals that in that case, OpenJPA with H2 embedded is 11.3 times faster than DataNucleus with PostgreSQL server.

On the other hand, OpenJPA with H2 embedded is slower, for instance, when using JPA element collections with small retrieval size. Comparing the normalized speed of OpenJPA with H2 embedded database (0.0046) to the normalized speed of DataNucleus with PostgreSQL database server (0.73) reveals that in that case, OpenJPA with H2 embedded is 159 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
 OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
Basic Person Test5.049.11.14.73.126.9
Element Collection Test1.739.11.30.481.519.8
Inheritance Test2.255.91.26.61.731.2
Indexing Test13.80.04823.26.418.53.2
Multithreading Test1.4failed0.60failed0.99failed
All Tests4.836.05.54.55.120.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 OpenJPA with H2 embedded in executing the tested JPA queries. Comparing the normalized speed of OpenJPA with H2 embedded database (5.1) to the normalized speed of DataNucleus with PostgreSQL database server (20.3) reveals that in these tests, DataNucleus with PostgreSQL server is 4.0 times faster than OpenJPA 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 OpenJPA with H2 embedded database (2.2) to the normalized speed of DataNucleus with PostgreSQL database server (55.9) reveals that in that case, DataNucleus with PostgreSQL server is 25.4 times faster than OpenJPA 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 OpenJPA with H2 embedded database (13.8) reveals that in that case, DataNucleus with PostgreSQL server is 288 times slower than OpenJPA with H2 embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
Basic Person Test10.02.16.00.848.01.5
Element Collection Test0.0111.43.80.641.91.0
Inheritance Test0.0462.15.01.22.51.7
Indexing Test8.92.27.01.58.01.8
Graph (Binary Tree) Test2.40.651.30.201.90.42
Multithreading Test16.60.464.3failed10.40.46
All Tests6.31.54.60.875.41.2

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

The results above show that in general OpenJPA 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 OpenJPA with H2 embedded database (5.4) reveals that in these tests, OpenJPA with H2 embedded is 4.5 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 OpenJPA with H2 embedded database (16.6) reveals that in that case, OpenJPA with H2 embedded is 36.1 times faster than DataNucleus with PostgreSQL server.

On the other hand, OpenJPA with H2 embedded is slower, for instance, when using JPA element collections with small transaction size. Comparing the normalized speed of OpenJPA with H2 embedded database (0.011) to the normalized speed of DataNucleus with PostgreSQL database server (1.4) reveals that in that case, OpenJPA with H2 embedded is 127 times slower than DataNucleus with PostgreSQL server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
Basic Person Test18.33.011.11.314.72.2
Element Collection Test0.0121.02.90.391.40.69
Inheritance Test0.0302.86.61.33.32.1
Indexing Test23.25.49.71.916.43.7
Graph (Binary Tree) Test1.80.382.40.372.10.37
Multithreading Test31.213.817.3failed24.213.8
All Tests12.44.48.31.110.42.9

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

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

A large performance gap has been detected when using simple basic entities with large transaction size. Comparing the normalized speed of DataNucleus with PostgreSQL database server (1.3) to the normalized speed of OpenJPA with H2 embedded database (11.1) reveals that in that case, OpenJPA with H2 embedded is 8.5 times faster than DataNucleus with PostgreSQL server.

On the other hand, OpenJPA with H2 embedded is slower, for instance, when using class inheritance in the object model with small transaction size. Comparing the normalized speed of OpenJPA with H2 embedded database (0.030) to the normalized speed of DataNucleus with PostgreSQL database server (2.8) reveals that in that case, OpenJPA with H2 embedded is 93.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
 OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
OpenJPA
H2 embedded
DataNucleus
PostgreSQL server
Basic Person Test13.012.010.23.411.67.7
Element Collection Test2.58.63.40.503.04.6
Inheritance Test3.313.25.24.24.38.7
Indexing Test17.53.017.75.117.64.0
Graph (Binary Tree) Test3.01.13.03.43.02.3
Multithreading Test20.48.912.09.516.29.1
All Tests10.28.08.83.89.56.0

The results above show that in general OpenJPA 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 OpenJPA with H2 embedded database (3.4) reveals that in that case, OpenJPA with H2 embedded is 6.8 times faster than DataNucleus with PostgreSQL server.

On the other hand, OpenJPA with H2 embedded is slower, for instance, when using class inheritance in the object model with small transaction/retrieval size. Comparing the normalized speed of OpenJPA with H2 embedded database (3.3) to the normalized speed of DataNucleus with PostgreSQL database server (13.2) reveals that in that case, OpenJPA with H2 embedded is 4.0 times slower than DataNucleus with PostgreSQL server.

Other Head to Head DBMS/JPA Comparisons