Compare with

Comparison of Hibernate with Derby 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
 Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Basic Person Test5.97.13.83.44.95.2
Element Collection Test2.92.91.81.72.32.3
Inheritance Test5.37.03.73.64.55.3
Indexing Test7.09.34.86.15.97.7
Graph (Binary Tree) Test1.93.01.72.91.82.9
Multithreading Test10.531.73.713.97.122.8
All Tests5.610.23.35.34.47.7

The results above show that in general Hibernate with PostgreSQL server is more efficient than Hibernate with Derby embedded in persisting JPA entity objects to the database.

A large performance gap has been detected when using multithreading with large transaction size. Comparing the normalized speed of Hibernate with Derby embedded database (3.7) to the normalized speed of Hibernate with PostgreSQL database server (13.9) reveals that in that case, Hibernate with PostgreSQL server is 3.8 times faster than Hibernate with Derby embedded.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Basic Person Test14.25.516.411.515.38.5
Element Collection Test4.40.0254.90.0174.60.021
Inheritance Test10.35.218.614.014.49.6
Indexing Test10.04.616.413.313.28.9
Graph (Binary Tree) Test2.60.613.00.782.80.70
Multithreading Test19.311.319.317.019.314.2
All Tests10.14.513.19.411.67.0

The results above show that in general Hibernate with Derby embedded is more efficient than Hibernate 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 Hibernate with PostgreSQL database server (0.017) to the normalized speed of Hibernate with Derby embedded database (4.9) reveals that in that case, Hibernate with Derby embedded is 288 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
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Basic Person Test49.355.56.86.128.130.8
Element Collection Test37.611.02.70.01620.15.5
Inheritance Test24.152.37.68.715.930.5
Indexing Test5.30.05014.88.810.14.4
Multithreading Test39.755.26.19.222.932.2
All Tests31.234.87.66.619.420.7

The results above show that in general Hibernate with PostgreSQL server is slightly more efficient than Hibernate with Derby embedded in executing the tested JPA queries.

A large performance gap has been detected when using class inheritance in the object model with small retrieval size. Comparing the normalized speed of Hibernate with Derby embedded database (24.1) to the normalized speed of Hibernate with PostgreSQL database server (52.3) reveals that in that case, Hibernate with PostgreSQL server is 2.2 times faster than Hibernate with Derby embedded.

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 Hibernate with Derby embedded database (2.7) reveals that in that case, Hibernate with PostgreSQL server is 169 times slower than Hibernate with Derby embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Basic Person Test4.55.33.22.73.84.0
Element Collection Test3.90.0673.10.0263.50.046
Inheritance Test4.65.44.53.84.54.6
Indexing Test4.65.45.54.35.14.8
Graph (Binary Tree) Test2.71.11.20.582.00.82
Multithreading Test11.629.62.66.37.118.0
All Tests5.37.83.32.94.35.4

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

A large performance gap has been detected when using multithreading with small transaction size. Comparing the normalized speed of Hibernate with Derby embedded database (11.6) to the normalized speed of Hibernate with PostgreSQL database server (29.6) reveals that in that case, Hibernate with PostgreSQL server is 2.6 times faster than Hibernate with Derby embedded.

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 Hibernate with Derby embedded database (3.1) reveals that in that case, Hibernate with PostgreSQL server is 119 times slower than Hibernate with Derby embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Basic Person Test3.85.34.24.24.04.8
Element Collection Test2.30.0201.5stopped1.90.0098
Inheritance Test4.05.14.34.24.24.6
Indexing Test5.59.53.66.34.67.9
Graph (Binary Tree) Test0.740.0120.960.0120.850.012
Multithreading Test5.623.34.921.85.322.5
All Tests3.77.23.36.13.56.6

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

A large performance gap has been detected when using multithreading with large transaction size. Comparing the normalized speed of Hibernate with Derby embedded database (4.9) to the normalized speed of Hibernate with PostgreSQL database server (21.8) reveals that in that case, Hibernate with PostgreSQL server is 4.4 times faster than Hibernate with Derby embedded.

On the other hand, Hibernate with PostgreSQL server is slower, for instance, when using JPA element collections with small transaction size. Comparing the normalized speed of Hibernate with PostgreSQL database server (0.020) to the normalized speed of Hibernate with Derby embedded database (2.3) reveals that in that case, Hibernate with PostgreSQL server is 115 times slower than Hibernate with Derby embedded.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Basic Person Test15.515.76.95.611.210.7
Element Collection Test10.22.82.80.356.51.6
Inheritance Test9.715.07.76.98.710.9
Indexing Test6.55.89.07.87.86.8
Graph (Binary Tree) Test2.01.21.71.11.81.1
Multithreading Test17.330.27.313.612.321.9
All Tests10.512.16.16.08.39.1

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

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 Hibernate with Derby embedded database (2.8) reveals that in that case, Hibernate with PostgreSQL server is 8.0 times slower than Hibernate with Derby embedded.

Other Head to Head DBMS/JPA Comparisons