We have migrated from Hibernate 5 to 6. Since this migration, we have noticed a downgrade in performance when lazy loading a collection of entity. I have reproduced the issue with the attached entities. In a postgresql DB, we have 150 000 books and 750 000 pages. When we load all books and then via the association all pages linked to books (FetchType.LAZY and FetchMode.SUBSELECT) :
- it takes several minutes with the 6.2.4 version of hibernate
- it takes several seconds with the 5.6.15 version of hibernate
After some analysis, we have noticed that we stay a lot of a time in ListResultsConsumer. When we aggregate the entities, it use the Results class and the addUnique method seem to have difficulties to handle a large bulk of entities to aggregate. It seems to be linked to https://hibernate.atlassian.net/browse/HHH-15479 Do we need something wrong in our mapping ? Do we have miss something during migration ? Thanks & Regards |