Compare with

Comparison of EclipseLink with PostgreSQL server vs Hibernate 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
 EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
Basic Person Test7.318.14.29.05.813.5
Element Collection Test3.113.01.96.82.59.9
Inheritance Test6.921.05.09.45.915.2
Indexing Test10.029.96.818.48.424.1
Graph (Binary Tree) Test3.517.23.320.13.418.7
Multithreading Test31.836.914.511.523.124.2
All Tests10.422.66.012.58.217.6

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

A large performance gap has been detected when using graphs of objects with large transaction size. Comparing the normalized speed of EclipseLink with PostgreSQL database server (3.3) to the normalized speed of Hibernate with H2 embedded database (20.1) reveals that in that case, Hibernate with H2 embedded is 6.1 times faster than EclipseLink with PostgreSQL server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
Basic Person Test6.816.617.213.312.015.0
Element Collection Test0.0264.30.0204.00.0234.1
Inheritance Test6.010.419.717.512.913.9
Indexing Test5.610.819.515.212.613.0
Graph (Binary Tree) Test0.472.50.614.00.543.3
Multithreading Test13.516.227.815.720.615.9
All Tests5.410.114.111.69.810.9

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

A huge performance gap has been detected when using JPA element collections with large retrieval size. Comparing the normalized speed of EclipseLink with PostgreSQL database server (0.020) to the normalized speed of Hibernate with H2 embedded database (4.0) reveals that in that case, Hibernate with H2 embedded is 200 times faster than EclipseLink with PostgreSQL server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
Basic Person Test55.54.57.81.231.62.8
Element Collection Test15.44.40.0281.47.72.9
Inheritance Test54.93.111.51.533.22.3
Indexing Test0.0776.610.010.55.18.6
Multithreading Test55.31.212.00.5933.70.89
All Tests36.24.08.33.022.33.5

The results above show that in general EclipseLink with PostgreSQL server is much more efficient than Hibernate with H2 embedded in executing the tested JPA queries. Comparing the normalized speed of Hibernate with H2 embedded database (3.5) to the normalized speed of EclipseLink with PostgreSQL database server (22.3) reveals that in these tests, EclipseLink with PostgreSQL server is 6.4 times faster than Hibernate with H2 embedded.

A huge performance gap has been detected when using multithreading with small retrieval size. Comparing the normalized speed of Hibernate with H2 embedded database (1.2) to the normalized speed of EclipseLink with PostgreSQL database server (55.3) reveals that in that case, EclipseLink with PostgreSQL server is 46.1 times faster than Hibernate with H2 embedded.

On the other hand, EclipseLink with PostgreSQL server is slower, for instance, when using database indexes with small retrieval size. Comparing the normalized speed of EclipseLink with PostgreSQL database server (0.077) to the normalized speed of Hibernate with H2 embedded database (6.6) reveals that in that case, EclipseLink with PostgreSQL server is 85.7 times slower than Hibernate with H2 embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
Basic Person Test6.212.14.16.55.19.3
Element Collection Test0.0807.40.0285.30.0546.3
Inheritance Test6.410.86.18.56.29.6
Indexing Test6.510.07.07.56.88.8
Graph (Binary Tree) Test0.904.40.502.30.703.4
Multithreading Test36.016.29.14.022.510.1
All Tests9.310.14.55.76.97.9

The results above show that in general Hibernate with H2 embedded is slightly more efficient than EclipseLink with PostgreSQL server in updating JPA entity objects in the database.

A huge performance gap has been detected when using JPA element collections with large transaction size. Comparing the normalized speed of EclipseLink with PostgreSQL database server (0.028) to the normalized speed of Hibernate with H2 embedded database (5.3) reveals that in that case, Hibernate with H2 embedded is 189 times faster than EclipseLink with PostgreSQL server.

On the other hand, Hibernate with H2 embedded is slower, for instance, when using multithreading with large transaction size. Comparing the normalized speed of Hibernate with H2 embedded database (4.0) to the normalized speed of EclipseLink with PostgreSQL database server (9.1) reveals that in that case, Hibernate with H2 embedded is 2.3 times slower than EclipseLink with PostgreSQL server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
Basic Person Test5.719.75.711.45.715.5
Element Collection Test0.0256.9stopped4.50.0125.7
Inheritance Test5.515.65.412.95.414.2
Indexing Test10.423.210.012.410.217.8
Graph (Binary Tree) Test0.0164.00.0134.20.0154.1
Multithreading Test26.327.416.822.721.625.0
All Tests8.016.16.311.47.213.7

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

A huge performance gap has been detected when using graphs of objects with large transaction size. Comparing the normalized speed of EclipseLink with PostgreSQL database server (0.013) to the normalized speed of Hibernate with H2 embedded database (4.2) reveals that in that case, Hibernate with H2 embedded is 323 times faster than EclipseLink with PostgreSQL server.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
Basic Person Test16.314.27.88.312.111.2
Element Collection Test3.77.20.404.42.15.8
Inheritance Test15.912.29.59.912.711.0
Indexing Test6.516.110.712.88.614.5
Graph (Binary Tree) Test1.27.01.17.71.27.3
Multithreading Test32.619.616.010.924.315.2
All Tests13.112.97.89.010.511.0

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

A huge performance gap has been detected when using JPA element collections with large transaction/retrieval size. Comparing the normalized speed of EclipseLink with PostgreSQL database server (0.40) to the normalized speed of Hibernate with H2 embedded database (4.4) reveals that in that case, Hibernate with H2 embedded is 11.0 times faster than EclipseLink with PostgreSQL server.

Other Head to Head DBMS/JPA Comparisons