79100648

Date: 2024-10-18 05:40:37
Score: 1
Natty:
Report link

Unless I am mistaken you are comparing the performance of two different database workloads. The hibernate query is running the Join Fetch to retrieve the related subscriber details which will likely be running an additional SQL query for each individual subscriber of each emailsubscription.

So you are looking at something like N + M in terms of the number of queries being submitted to the database. Where N is the number of emailsubscriptions and M is the number of subscribers per emailsubscription. In comparison the native query is submitting a single request to the database.

if you configure a batch size for the subscriber fetches you could reduce this to something like N + M/BatchSize

hibernate batch fetching

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: tristan