Compare with

Comparison of OpenJPA with MySQL 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
MySQL server
OpenJPA
PostgreSQL server
OpenJPA
MySQL server
OpenJPA
PostgreSQL server
OpenJPA
MySQL server
OpenJPA
PostgreSQL server
Basic Person Test3.95.21.64.82.75.0
Element Collection Test1.62.80.682.21.12.5
Inheritance Test3.64.61.43.22.53.9
Indexing Test5.67.42.46.94.07.1
Graph (Binary Tree) Test0.680.980.570.810.630.89
Multithreading Test7.223.42.79.14.916.2
All Tests3.77.41.54.52.65.9

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

A large performance gap has been detected when using multithreading with large transaction size. Comparing the normalized speed of OpenJPA with MySQL database server (2.7) to the normalized speed of OpenJPA with PostgreSQL database server (9.1) reveals that in that case, OpenJPA with PostgreSQL server is 3.4 times faster than OpenJPA with MySQL server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
MySQL server
OpenJPA
PostgreSQL server
OpenJPA
MySQL server
OpenJPA
PostgreSQL server
OpenJPA
MySQL server
OpenJPA
PostgreSQL server
Basic Person Test3.25.822.716.112.910.9
Element Collection Test0.00380.0132.98.71.44.4
Inheritance Test0.0175.26.917.63.411.4
Indexing Test2.44.823.418.712.911.8
Graph (Binary Tree) Test0.270.270.350.350.310.31
Multithreading Test0.1411.918.123.39.117.6
All Tests1.04.712.414.16.79.4

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

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 MySQL database server (0.017) to the normalized speed of OpenJPA with PostgreSQL database server (5.2) reveals that in that case, OpenJPA with PostgreSQL server is 306 times faster than OpenJPA with MySQL server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
MySQL server
OpenJPA
PostgreSQL server
OpenJPA
MySQL server
OpenJPA
PostgreSQL server
OpenJPA
MySQL server
OpenJPA
PostgreSQL server
Basic Person Test9.3failed2.2failed5.8failed
Element Collection Test4.8failed1.1failed2.9failed
Inheritance Test1.5failed0.90failed1.2failed
Indexing Test0.31failed2.1failed1.2failed
Multithreading Test1.9failed0.99failed1.4failed
All Tests3.6failed1.5failed2.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
MySQL server
OpenJPA
PostgreSQL server
OpenJPA
MySQL server
OpenJPA
PostgreSQL server
OpenJPA
MySQL server
OpenJPA
PostgreSQL server
Basic Person Test0.744.91.63.91.24.4
Element Collection Test0.0140.0331.74.60.872.3
Inheritance Test0.0484.82.04.91.04.9
Indexing Test0.745.13.06.01.95.6
Graph (Binary Tree) Test0.450.570.250.310.350.44
Multithreading Test0.5522.22.97.41.714.8
All Tests0.426.31.94.51.25.4

The results above show that in general OpenJPA with PostgreSQL server is much more efficient than OpenJPA with MySQL server in updating JPA entity objects in the database. Comparing the normalized speed of OpenJPA with MySQL database server (1.2) to the normalized speed of OpenJPA with PostgreSQL database server (5.4) reveals that in these tests, OpenJPA with PostgreSQL server is 4.5 times faster than OpenJPA with MySQL 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 MySQL database server (0.048) to the normalized speed of OpenJPA with PostgreSQL database server (4.8) reveals that in that case, OpenJPA with PostgreSQL server is 100 times faster than OpenJPA with MySQL server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
MySQL server
OpenJPA
PostgreSQL server
OpenJPA
MySQL server
OpenJPA
PostgreSQL server
OpenJPA
MySQL server
OpenJPA
PostgreSQL server
Basic Person Test0.984.61.75.31.45.0
Element Collection Test0.00990.0320.652.80.331.4
Inheritance Test0.0334.31.54.60.754.4
Indexing Test0.648.02.07.11.37.5
Graph (Binary Tree) Test0.410.530.430.550.420.54
Multithreading Test0.2717.42.99.11.613.3
All Tests0.395.81.54.90.965.4

The results above show that in general OpenJPA with PostgreSQL server is much more efficient than OpenJPA with MySQL server in deleting JPA entity objects from the database. Comparing the normalized speed of OpenJPA with MySQL database server (0.96) to the normalized speed of OpenJPA with PostgreSQL database server (5.4) reveals that in these tests, OpenJPA with PostgreSQL server is 5.6 times faster than OpenJPA with MySQL 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 MySQL database server (0.033) to the normalized speed of OpenJPA with PostgreSQL database server (4.3) reveals that in that case, OpenJPA with PostgreSQL server is 130 times faster than OpenJPA with MySQL server.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 OpenJPA
MySQL server
OpenJPA
PostgreSQL server
OpenJPA
MySQL server
OpenJPA
PostgreSQL server
OpenJPA
MySQL server
OpenJPA
PostgreSQL server
Basic Person Test3.65.16.07.54.86.3
Element Collection Test1.30.721.44.61.32.6
Inheritance Test1.04.72.57.61.86.2
Indexing Test1.96.36.69.74.38.0
Graph (Binary Tree) Test0.450.590.400.500.430.55
Multithreading Test2.018.75.512.23.815.5
All Tests1.86.03.97.02.86.5

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

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

Other Head to Head DBMS/JPA Comparisons