Compare with

Comparison of OpenJPA with PostgreSQL server vs OpenJPA with H2 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
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
Basic Person Test5.23.74.82.25.02.9
Element Collection Test2.82.62.21.52.52.1
Inheritance Test4.64.53.22.03.93.2
Indexing Test7.47.36.93.67.15.4
Graph (Binary Tree) Test0.981.10.810.840.890.97
Multithreading Test23.47.79.14.216.25.9
All Tests7.44.54.52.45.93.4

The results above show that in general OpenJPA with PostgreSQL server is more efficient than OpenJPA 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 OpenJPA with H2 database server (7.7) to the normalized speed of OpenJPA with PostgreSQL database server (23.4) reveals that in that case, OpenJPA with PostgreSQL server is 3.0 times faster than OpenJPA with H2 server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
Basic Person Test5.82.916.17.610.95.2
Element Collection Test0.0130.00228.71.94.40.93
Inheritance Test5.20.01317.64.011.42.0
Indexing Test4.84.118.78.811.86.5
Graph (Binary Tree) Test0.270.380.350.490.310.44
Multithreading Test11.95.923.314.017.610.0
All Tests4.72.214.16.19.44.2

The results above show that in general OpenJPA with PostgreSQL server is more efficient than OpenJPA with H2 server in retrieving JPA entity objects from the database. Comparing the normalized speed of OpenJPA with H2 database server (4.2) to the normalized speed of OpenJPA with PostgreSQL database server (9.4) reveals that in these tests, OpenJPA with PostgreSQL server is 2.2 times faster than OpenJPA 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 OpenJPA with H2 database server (0.013) to the normalized speed of OpenJPA with PostgreSQL database server (5.2) reveals that in that case, OpenJPA with PostgreSQL server is 400 times faster than OpenJPA with H2 server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
Basic Person Testfailed3.7failed1.0failed2.4
Element Collection Testfailed2.0failed1.2failed1.6
Inheritance Testfailed2.8failed1.1failed2.0
Indexing Testfailed3.8failed7.5failed5.7
Multithreading Testfailed0.98failed1.0failed1.0
All Testsfailed2.7failed2.4failed2.5

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
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
Basic Person Test4.93.03.92.04.42.5
Element Collection Test0.0330.00784.61.92.30.94
Inheritance Test4.80.0344.92.84.91.4
Indexing Test5.12.86.03.25.63.0
Graph (Binary Tree) Test0.570.790.310.430.440.61
Multithreading Test22.27.07.42.514.84.8
All Tests6.32.34.52.15.42.2

The results above show that in general OpenJPA with PostgreSQL server is more efficient than OpenJPA with H2 server in updating JPA entity objects in the database. Comparing the normalized speed of OpenJPA with H2 database server (2.2) to the normalized speed of OpenJPA with PostgreSQL database server (5.4) reveals that in these tests, OpenJPA with PostgreSQL server is 2.5 times faster than OpenJPA with H2 server.

A huge performance gap has been detected when using class inheritance in the object model with small transaction size. Comparing the normalized speed of OpenJPA with H2 database server (0.034) to the normalized speed of OpenJPA with PostgreSQL database server (4.8) reveals that in that case, OpenJPA with PostgreSQL server is 141 times faster than OpenJPA with H2 server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
Basic Person Test4.63.25.32.25.02.7
Element Collection Test0.0320.00602.80.881.40.44
Inheritance Test4.30.0304.63.14.41.6
Indexing Test8.06.57.13.67.55.1
Graph (Binary Tree) Test0.530.730.550.750.540.74
Multithreading Test17.47.69.15.213.36.4
All Tests5.83.04.92.65.42.8

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

A huge performance gap has been detected when using class inheritance in the object model with small transaction size. Comparing the normalized speed of OpenJPA with H2 database server (0.030) to the normalized speed of OpenJPA with PostgreSQL database server (4.3) reveals that in that case, OpenJPA with PostgreSQL server is 143 times faster than OpenJPA with H2 server.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
Basic Person Test5.13.37.53.06.33.1
Element Collection Test0.720.934.61.52.61.2
Inheritance Test4.71.57.62.66.22.0
Indexing Test6.34.99.75.48.05.1
Graph (Binary Tree) Test0.590.750.500.630.550.69
Multithreading Test18.75.912.25.415.55.6
All Tests6.02.97.03.26.53.0

The results above show that in general OpenJPA with PostgreSQL server is more efficient than OpenJPA with H2 server in performing JPA database operations. Comparing the normalized speed of OpenJPA with H2 database server (3.0) to the normalized speed of OpenJPA with PostgreSQL database server (6.5) reveals that in these tests, OpenJPA with PostgreSQL server is 2.2 times faster than OpenJPA with H2 server.

A large performance gap has been detected when using multithreading with small transaction/retrieval size. Comparing the normalized speed of OpenJPA with H2 database server (5.9) to the normalized speed of OpenJPA with PostgreSQL database server (18.7) reveals that in that case, OpenJPA with PostgreSQL server is 3.2 times faster than OpenJPA with H2 server.

Other Head to Head DBMS/JPA Comparisons