Hello!
We recently upgraded from Java 8 to 17 and in doing so we switched Hibernate Core from 5.4.17.Final to 6.5.3.Final. Now we encountered this weird bug, when a QueryDSL query gets executed for the first time it takes way more time it did before the upgrade.
Before the upgrade when the query got executed the first time it also did take more time than on consecutive calls, but now it takes way more time - like by a factor of 100. If this query is executed again (even with different parameters) the performance is back to normal and it takes less than 50ms.
This seems to happen for rather complex queries.
Here is a screenshot of the profiling:
The method com.querydsl.jpa.impl.AbstractJPAQuery.fetch()
took ~95% of all after the upgrade whereas before the upgrade it took only ~30% of all. In addition, there are now many calls to the Antlr library that weren’t there before.
Im not sure if the problem is in Hibernate or in QueryDSL because before the upgrade we used QueryDSL 4.3.1. But after the upgrade we had to switch QueryDSL 5.1.0 (because of jakarta). (I even tested with the QueryDSL OpenFeign fork 6.8 but had the same results.) Therefore, I can’t test it with the older QueryDSL version - or is there a way?
The generated SQL looks kinda the same, but I don’t suspect it’s the SQL because for the second and consecutive executions the performance is good.
Do you have any idea what else I could check? I’m grateful for any advice!