Compare with

Comparison of OpenJPA with H2 server vs OpenJPA 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 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
Basic Person Test3.75.22.24.82.95.0
Element Collection Test2.62.81.52.22.12.5
Inheritance Test4.54.62.03.23.23.9
Indexing Test7.37.43.66.95.47.1
Graph (Binary Tree) Test1.10.980.840.810.970.89
Multithreading Test7.723.44.29.15.916.2
All Tests4.57.42.44.53.45.9

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
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
Basic Person Test2.95.87.616.15.210.9
Element Collection Test0.00220.0131.98.70.934.4
Inheritance Test0.0135.24.017.62.011.4
Indexing Test4.14.88.818.76.511.8
Graph (Binary Tree) Test0.380.270.490.350.440.31
Multithreading Test5.911.914.023.310.017.6
All Tests2.24.76.114.14.29.4

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
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
Basic Person Test3.7failed1.0failed2.4failed
Element Collection Test2.0failed1.2failed1.6failed
Inheritance Test2.8failed1.1failed2.0failed
Indexing Test3.8failed7.5failed5.7failed
Multithreading Test0.98failed1.0failed1.0failed
All Tests2.7failed2.4failed2.5failed

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
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
Basic Person Test3.04.92.03.92.54.4
Element Collection Test0.00780.0331.94.60.942.3
Inheritance Test0.0344.82.84.91.44.9
Indexing Test2.85.13.26.03.05.6
Graph (Binary Tree) Test0.790.570.430.310.610.44
Multithreading Test7.022.22.57.44.814.8
All Tests2.36.32.14.52.25.4

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
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
Basic Person Test3.24.62.25.32.75.0
Element Collection Test0.00600.0320.882.80.441.4
Inheritance Test0.0304.33.14.61.64.4
Indexing Test6.58.03.67.15.17.5
Graph (Binary Tree) Test0.730.530.750.550.740.54
Multithreading Test7.617.45.29.16.413.3
All Tests3.05.82.64.92.85.4

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
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
OpenJPA
H2 server
OpenJPA
PostgreSQL server
Basic Person Test3.35.13.07.53.16.3
Element Collection Test0.930.721.54.61.22.6
Inheritance Test1.54.72.67.62.06.2
Indexing Test4.96.35.49.75.18.0
Graph (Binary Tree) Test0.750.590.630.500.690.55
Multithreading Test5.918.75.412.25.615.5
All Tests2.96.03.27.03.06.5

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