Compare with

Comparison of OpenJPA with PostgreSQL server vs DataNucleus 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
 OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
Basic Person Test5.219.24.88.05.013.6
Element Collection Test2.86.62.22.82.54.7
Inheritance Test4.615.63.24.43.910.0
Indexing Test7.424.46.911.87.118.1
Graph (Binary Tree) Test0.989.20.816.20.897.7
Multithreading Test23.434.99.17.116.221.0
All Tests7.418.34.56.75.912.5

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

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
Basic Person Test5.813.216.113.510.913.3
Element Collection Test0.0136.48.78.94.47.7
Inheritance Test5.212.217.612.711.412.4
Indexing Test4.88.118.716.511.812.3
Graph (Binary Tree) Test0.2710.60.3520.90.3115.8
Multithreading Test11.913.323.39.917.611.6
All Tests4.710.614.113.79.412.2

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

A huge performance gap has been detected when using JPA element collections with small retrieval size. Comparing the normalized speed of OpenJPA with PostgreSQL database server (0.013) to the normalized speed of DataNucleus with H2 embedded database (6.4) reveals that in that case, DataNucleus with H2 embedded is 492 times faster than OpenJPA with PostgreSQL server.

On the other hand, DataNucleus with H2 embedded is slower, for instance, when using multithreading with large retrieval size. Comparing the normalized speed of DataNucleus with H2 embedded database (9.9) to the normalized speed of OpenJPA with PostgreSQL database server (23.3) reveals that in that case, DataNucleus with H2 embedded is 2.4 times slower than OpenJPA with PostgreSQL server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
Basic Person Testfailed4.7failed1.4failed3.1
Element Collection Testfailed5.0failed2.4failed3.7
Inheritance Testfailed3.8failed1.6failed2.7
Indexing Testfailed0.0041failed1.8failed0.91
Multithreading Testfailed1.2failed0.79failed1.0
All Testsfailed3.0failed1.6failed2.3

OpenJPA with PostgreSQL server has failed in 10 tests (see exceptions).

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
Basic Person Test4.910.03.93.94.46.9
Element Collection Test0.0337.64.63.92.35.8
Inheritance Test4.89.44.94.44.96.9
Indexing Test5.110.66.05.95.68.2
Graph (Binary Tree) Test0.575.90.313.70.444.8
Multithreading Test22.2failed7.4failed14.8failed
All Tests6.38.74.54.45.46.5

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 OpenJPA with PostgreSQL server in updating JPA entity objects in the database.

A huge performance gap has been detected when using JPA element collections with small transaction size. Comparing the normalized speed of OpenJPA with PostgreSQL database server (0.033) to the normalized speed of DataNucleus with H2 embedded database (7.6) reveals that in that case, DataNucleus with H2 embedded is 230 times faster than OpenJPA with PostgreSQL server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
Basic Person Test4.64.25.31.35.02.8
Element Collection Test0.0324.92.81.61.43.2
Inheritance Test4.34.04.61.34.42.7
Indexing Test8.07.57.11.97.54.7
Graph (Binary Tree) Test0.535.60.554.10.544.8
Multithreading Test17.4failed9.1failed13.3failed
All Tests5.85.24.92.05.43.6

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

The results above show that in general OpenJPA 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 simple basic entities with large transaction size. Comparing the normalized speed of DataNucleus with H2 embedded database (1.3) to the normalized speed of OpenJPA with PostgreSQL database server (5.3) reveals that in that case, OpenJPA with PostgreSQL server is 4.1 times faster than DataNucleus with H2 embedded.

On the other hand, OpenJPA with PostgreSQL server is slower, for instance, when using JPA element collections with small transaction size. Comparing the normalized speed of OpenJPA with PostgreSQL database server (0.032) to the normalized speed of DataNucleus with H2 embedded database (4.9) reveals that in that case, OpenJPA with PostgreSQL server is 153 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
 OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
OpenJPA
PostgreSQL server
DataNucleus
H2 embedded
Basic Person Test5.110.37.55.66.37.9
Element Collection Test0.726.14.63.92.65.0
Inheritance Test4.79.07.64.96.26.9
Indexing Test6.310.19.77.68.08.9
Graph (Binary Tree) Test0.597.80.508.70.558.3
Multithreading Test18.716.512.25.915.511.2
All Tests6.09.67.06.06.57.8

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

A huge performance gap has been detected when using graphs of objects with large transaction/retrieval size. Comparing the normalized speed of OpenJPA with PostgreSQL database server (0.50) to the normalized speed of DataNucleus with H2 embedded database (8.7) reveals that in that case, DataNucleus with H2 embedded is 17.4 times faster than OpenJPA with PostgreSQL server.

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

Other Head to Head DBMS/JPA Comparisons