Compare with

Comparison of Hibernate with PostgreSQL server vs EclipseLink 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
 Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Basic Person Test7.125.13.48.95.217.0
Element Collection Test2.920.41.78.02.314.2
Inheritance Test7.028.73.68.75.318.7
Indexing Test9.337.66.114.07.725.8
Graph (Binary Tree) Test3.017.72.914.72.916.2
Multithreading Test31.730.313.911.422.820.8
All Tests10.226.65.310.97.718.8

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

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Basic Person Test5.530.411.529.18.529.7
Element Collection Test0.02519.60.01727.60.02123.6
Inheritance Test5.233.814.039.89.636.8
Indexing Test4.622.213.341.38.931.8
Graph (Binary Tree) Test0.6116.00.7820.00.7018.0
Multithreading Test11.333.717.029.014.231.4
All Tests4.525.99.431.17.028.5

The results above show that in general EclipseLink with H2 embedded is much more efficient than Hibernate with PostgreSQL server in retrieving JPA entity objects from the database. Comparing the normalized speed of Hibernate with PostgreSQL database server (7.0) to the normalized speed of EclipseLink with H2 embedded database (28.5) reveals that in these tests, EclipseLink with H2 embedded is 4.1 times faster than Hibernate with PostgreSQL server.

A huge performance gap has been detected 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 EclipseLink with H2 embedded database (27.6) reveals that in that case, EclipseLink with H2 embedded is 1,624 times faster than Hibernate with PostgreSQL server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Basic Person Test55.54.46.11.430.82.9
Element Collection Test11.04.10.0162.45.53.2
Inheritance Test52.33.48.72.030.52.7
Indexing Test0.05013.08.822.84.417.9
Multithreading Test55.21.09.20.6732.20.85
All Tests34.85.26.65.920.75.5

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

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

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

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Basic Person Test5.316.62.77.64.012.1
Element Collection Test0.06715.30.02610.50.04612.9
Inheritance Test5.415.73.89.84.612.7
Indexing Test5.412.14.39.94.811.0
Graph (Binary Tree) Test1.113.70.587.00.8210.3
Multithreading Test29.620.96.34.218.012.6
All Tests7.815.72.98.25.412.0

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

A huge performance gap has been detected 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 EclipseLink with H2 embedded database (10.5) reveals that in that case, EclipseLink with H2 embedded is 404 times faster than Hibernate with PostgreSQL server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Basic Person Test5.335.14.219.64.827.4
Element Collection Test0.02019.3stopped8.50.009813.9
Inheritance Test5.136.04.214.04.625.0
Indexing Test9.542.56.319.27.930.9
Graph (Binary Tree) Test0.01212.20.01214.40.01213.3
Multithreading Test23.354.421.825.822.540.1
All Tests7.233.36.116.96.625.1

The results above show that in general EclipseLink with H2 embedded is much more efficient than Hibernate with PostgreSQL server in deleting JPA entity objects from the database. Comparing the normalized speed of Hibernate with PostgreSQL database server (6.6) to the normalized speed of EclipseLink with H2 embedded database (25.1) reveals that in these tests, EclipseLink with H2 embedded is 3.8 times faster than Hibernate with PostgreSQL server.

A huge performance gap has been detected 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 EclipseLink with H2 embedded database (14.4) reveals that in that case, EclipseLink with H2 embedded is 1,200 times faster than Hibernate with PostgreSQL server.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Basic Person Test15.722.35.613.310.717.8
Element Collection Test2.815.70.3511.41.613.6
Inheritance Test15.023.56.914.910.919.2
Indexing Test5.825.57.821.56.823.5
Graph (Binary Tree) Test1.214.91.114.01.114.5
Multithreading Test30.228.113.614.221.921.1
All Tests12.121.96.014.99.118.4

The results above show that in general EclipseLink with H2 embedded is more efficient than Hibernate with PostgreSQL server in performing JPA database operations. Comparing the normalized speed of Hibernate with PostgreSQL database server (9.1) to the normalized speed of EclipseLink with H2 embedded database (18.4) reveals that in these tests, EclipseLink with H2 embedded is 2.0 times faster than Hibernate with PostgreSQL server.

A huge performance gap has been detected 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 EclipseLink with H2 embedded database (11.4) reveals that in that case, EclipseLink with H2 embedded is 32.6 times faster than Hibernate with PostgreSQL server.

Other Head to Head DBMS/JPA Comparisons