Compare with

Comparison of OpenJPA with MySQL server vs Hibernate 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
Hibernate
PostgreSQL server
OpenJPA
MySQL server
Hibernate
PostgreSQL server
OpenJPA
MySQL server
Hibernate
PostgreSQL server
Basic Person Test3.97.11.63.42.75.2
Element Collection Test1.62.90.681.71.12.3
Inheritance Test3.67.01.43.62.55.3
Indexing Test5.69.32.46.14.07.7
Graph (Binary Tree) Test0.683.00.572.90.632.9
Multithreading Test7.231.72.713.94.922.8
All Tests3.710.21.55.32.67.7

The results above show that in general Hibernate 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 Hibernate with PostgreSQL database server (7.7) reveals that in these tests, Hibernate with PostgreSQL server is 3.0 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 Hibernate with PostgreSQL database server (13.9) reveals that in that case, Hibernate with PostgreSQL server is 5.1 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
Hibernate
PostgreSQL server
OpenJPA
MySQL server
Hibernate
PostgreSQL server
OpenJPA
MySQL server
Hibernate
PostgreSQL server
Basic Person Test3.25.522.711.512.98.5
Element Collection Test0.00380.0252.90.0171.40.021
Inheritance Test0.0175.26.914.03.49.6
Indexing Test2.44.623.413.312.98.9
Graph (Binary Tree) Test0.270.610.350.780.310.70
Multithreading Test0.1411.318.117.09.114.2
All Tests1.04.512.49.46.77.0

The results above show that in general Hibernate with PostgreSQL server is slightly 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 Hibernate with PostgreSQL database server (5.2) reveals that in that case, Hibernate with PostgreSQL server is 306 times faster than OpenJPA with MySQL server.

On the other hand, Hibernate with PostgreSQL server is slower, for instance, when using JPA element collections with large retrieval size. Comparing the normalized speed of Hibernate with PostgreSQL database server (0.017) to the normalized speed of OpenJPA with MySQL database server (2.9) reveals that in that case, Hibernate with PostgreSQL server is 171 times slower 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
Hibernate
PostgreSQL server
OpenJPA
MySQL server
Hibernate
PostgreSQL server
OpenJPA
MySQL server
Hibernate
PostgreSQL server
Basic Person Test9.355.52.26.15.830.8
Element Collection Test4.811.01.10.0162.95.5
Inheritance Test1.552.30.908.71.230.5
Indexing Test0.310.0502.18.81.24.4
Multithreading Test1.955.20.999.21.432.2
All Tests3.634.81.56.62.520.7

The results above show that in general Hibernate with PostgreSQL server is much more efficient than OpenJPA with MySQL server in executing the tested JPA queries. Comparing the normalized speed of OpenJPA with MySQL database server (2.5) to the normalized speed of Hibernate with PostgreSQL database server (20.7) reveals that in these tests, Hibernate with PostgreSQL server is 8.3 times faster than OpenJPA with MySQL 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 MySQL database server (1.5) to the normalized speed of Hibernate with PostgreSQL database server (52.3) reveals that in that case, Hibernate with PostgreSQL server is 34.9 times faster than OpenJPA with MySQL server.

On the other hand, Hibernate with PostgreSQL server is slower, for instance, when using JPA element collections with large retrieval size. Comparing the normalized speed of Hibernate with PostgreSQL database server (0.016) to the normalized speed of OpenJPA with MySQL database server (1.1) reveals that in that case, Hibernate with PostgreSQL server is 68.8 times slower than OpenJPA with MySQL server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
MySQL server
Hibernate
PostgreSQL server
OpenJPA
MySQL server
Hibernate
PostgreSQL server
OpenJPA
MySQL server
Hibernate
PostgreSQL server
Basic Person Test0.745.31.62.71.24.0
Element Collection Test0.0140.0671.70.0260.870.046
Inheritance Test0.0485.42.03.81.04.6
Indexing Test0.745.43.04.31.94.8
Graph (Binary Tree) Test0.451.10.250.580.350.82
Multithreading Test0.5529.62.96.31.718.0
All Tests0.427.81.92.91.25.4

The results above show that in general Hibernate 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 Hibernate with PostgreSQL database server (5.4) reveals that in these tests, Hibernate 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 Hibernate with PostgreSQL database server (5.4) reveals that in that case, Hibernate with PostgreSQL server is 112 times faster than OpenJPA with MySQL server.

On the other hand, Hibernate with PostgreSQL server is slower, for instance, when using JPA element collections with large transaction size. Comparing the normalized speed of Hibernate with PostgreSQL database server (0.026) to the normalized speed of OpenJPA with MySQL database server (1.7) reveals that in that case, Hibernate with PostgreSQL server is 65.4 times slower 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
Hibernate
PostgreSQL server
OpenJPA
MySQL server
Hibernate
PostgreSQL server
OpenJPA
MySQL server
Hibernate
PostgreSQL server
Basic Person Test0.985.31.74.21.44.8
Element Collection Test0.00990.0200.65stopped0.330.0098
Inheritance Test0.0335.11.54.20.754.6
Indexing Test0.649.52.06.31.37.9
Graph (Binary Tree) Test0.410.0120.430.0120.420.012
Multithreading Test0.2723.32.921.81.622.5
All Tests0.397.21.56.10.966.6

The results above show that in general Hibernate 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 Hibernate with PostgreSQL database server (6.6) reveals that in these tests, Hibernate with PostgreSQL server is 6.9 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 Hibernate with PostgreSQL database server (5.1) reveals that in that case, Hibernate with PostgreSQL server is 155 times faster than OpenJPA with MySQL server.

On the other hand, Hibernate with PostgreSQL server is slower, for instance, when using graphs of objects with large transaction size. Comparing the normalized speed of Hibernate with PostgreSQL database server (0.012) to the normalized speed of OpenJPA with MySQL database server (0.43) reveals that in that case, Hibernate with PostgreSQL server is 35.8 times slower 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
Hibernate
PostgreSQL server
OpenJPA
MySQL server
Hibernate
PostgreSQL server
OpenJPA
MySQL server
Hibernate
PostgreSQL server
Basic Person Test3.615.76.05.64.810.7
Element Collection Test1.32.81.40.351.31.6
Inheritance Test1.015.02.56.91.810.9
Indexing Test1.95.86.67.84.36.8
Graph (Binary Tree) Test0.451.20.401.10.431.1
Multithreading Test2.030.25.513.63.821.9
All Tests1.812.13.96.02.89.1

The results above show that in general Hibernate with PostgreSQL server is much 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 Hibernate with PostgreSQL database server (9.1) reveals that in these tests, Hibernate with PostgreSQL server is 3.2 times faster than OpenJPA with MySQL server.

A huge 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 Hibernate with PostgreSQL database server (30.2) reveals that in that case, Hibernate with PostgreSQL server is 15.1 times faster than OpenJPA with MySQL server.

On the other hand, Hibernate with PostgreSQL server is slower, for instance, when using JPA element collections with large transaction/retrieval size. Comparing the normalized speed of Hibernate with PostgreSQL database server (0.35) to the normalized speed of OpenJPA with MySQL database server (1.4) reveals that in that case, Hibernate with PostgreSQL server is 4.0 times slower than OpenJPA with MySQL server.

Other Head to Head DBMS/JPA Comparisons