Compare with

Comparison of EclipseLink with H2 embedded 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
 EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
Basic Person Test25.17.18.93.417.05.2
Element Collection Test20.42.98.01.714.22.3
Inheritance Test28.77.08.73.618.75.3
Indexing Test37.69.314.06.125.87.7
Graph (Binary Tree) Test17.73.014.72.916.22.9
Multithreading Test30.331.711.413.920.822.8
All Tests26.610.210.95.318.87.7

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
 EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
Basic Person Test30.45.529.111.529.78.5
Element Collection Test19.60.02527.60.01723.60.021
Inheritance Test33.85.239.814.036.89.6
Indexing Test22.24.641.313.331.88.9
Graph (Binary Tree) Test16.00.6120.00.7818.00.70
Multithreading Test33.711.329.017.031.414.2
All Tests25.94.531.19.428.57.0

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
 EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
Basic Person Test4.455.51.46.12.930.8
Element Collection Test4.111.02.40.0163.25.5
Inheritance Test3.452.32.08.72.730.5
Indexing Test13.00.05022.88.817.94.4
Multithreading Test1.055.20.679.20.8532.2
All Tests5.234.85.96.65.520.7

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
 EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
Basic Person Test16.65.37.62.712.14.0
Element Collection Test15.30.06710.50.02612.90.046
Inheritance Test15.75.49.83.812.74.6
Indexing Test12.15.49.94.311.04.8
Graph (Binary Tree) Test13.71.17.00.5810.30.82
Multithreading Test20.929.64.26.312.618.0
All Tests15.77.88.22.912.05.4

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
 EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
Basic Person Test35.15.319.64.227.44.8
Element Collection Test19.30.0208.5stopped13.90.0098
Inheritance Test36.05.114.04.225.04.6
Indexing Test42.59.519.26.330.97.9
Graph (Binary Tree) Test12.20.01214.40.01213.30.012
Multithreading Test54.423.325.821.840.122.5
All Tests33.37.216.96.125.16.6

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
 EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
EclipseLink
H2 embedded
Hibernate
PostgreSQL server
Basic Person Test22.315.713.35.617.810.7
Element Collection Test15.72.811.40.3513.61.6
Inheritance Test23.515.014.96.919.210.9
Indexing Test25.55.821.57.823.56.8
Graph (Binary Tree) Test14.91.214.01.114.51.1
Multithreading Test28.130.214.213.621.121.9
All Tests21.912.114.96.018.49.1

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