Compare with

Comparison of Hibernate with PostgreSQL server vs Hibernate with Derby 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
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Basic Person Test7.15.93.43.85.24.9
Element Collection Test2.92.91.71.82.32.3
Inheritance Test7.05.33.63.75.34.5
Indexing Test9.37.06.14.87.75.9
Graph (Binary Tree) Test3.01.92.91.72.91.8
Multithreading Test31.710.513.93.722.87.1
All Tests10.25.65.33.37.74.4

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
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Basic Person Test5.514.211.516.48.515.3
Element Collection Test0.0254.40.0174.90.0214.6
Inheritance Test5.210.314.018.69.614.4
Indexing Test4.610.013.316.48.913.2
Graph (Binary Tree) Test0.612.60.783.00.702.8
Multithreading Test11.319.317.019.314.219.3
All Tests4.510.19.413.17.011.6

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
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Basic Person Test55.549.36.16.830.828.1
Element Collection Test11.037.60.0162.75.520.1
Inheritance Test52.324.18.77.630.515.9
Indexing Test0.0505.38.814.84.410.1
Multithreading Test55.239.79.26.132.222.9
All Tests34.831.26.67.620.719.4

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
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Basic Person Test5.34.52.73.24.03.8
Element Collection Test0.0673.90.0263.10.0463.5
Inheritance Test5.44.63.84.54.64.5
Indexing Test5.44.64.35.54.85.1
Graph (Binary Tree) Test1.12.70.581.20.822.0
Multithreading Test29.611.66.32.618.07.1
All Tests7.85.32.93.35.44.3

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
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Basic Person Test5.33.84.24.24.84.0
Element Collection Test0.0202.3stopped1.50.00981.9
Inheritance Test5.14.04.24.34.64.2
Indexing Test9.55.56.33.67.94.6
Graph (Binary Tree) Test0.0120.740.0120.960.0120.85
Multithreading Test23.35.621.84.922.55.3
All Tests7.23.76.13.36.63.5

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
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Hibernate
PostgreSQL server
Hibernate
Derby embedded
Basic Person Test15.715.55.66.910.711.2
Element Collection Test2.810.20.352.81.66.5
Inheritance Test15.09.76.97.710.98.7
Indexing Test5.86.57.89.06.87.8
Graph (Binary Tree) Test1.22.01.11.71.11.8
Multithreading Test30.217.313.67.321.912.3
All Tests12.110.56.06.19.18.3

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