Good morning
Recently I have tried to upgrade my app from Hibernate 6.3 to Hibernate 6.5 but I faced a performance degration when querying a field with IN clause and pasing an emptyParameter
The query is similar to
SELECT p FROM processes p where p.jobId in (:jobIds) order by p.id desc
where jobIds can be an empty collection.
When using Hibernate 6.3 the query generated was
select
p1_0.id,
p1_0.XXX,
...
p1_0.jobId
from
schema.processes p1_0
where 1=0 order by p1_0.id desc
but after moving up to Hibernate 6.5 the query generated is
select
p1_0.id,
p1_0.XXX,
...
p1_0.jobId
from
schema.processes p1_0
where (1 = case when p1_0.jobId is not null then 0 end)
order by p1_0.id desc
When the table has 0.5M records it degradates from 0.1s to 20s getting worse when the table size is bigger.
Let me know if you need more information.
Thanks.