1.

How to solve N+1 SELECT problem in Hibernate?

Answer»

Some of the strategies followed for solving the N+1 SELECT PROBLEM are:

  • Pre-fetch the records in BATCHES which HELPS us to reduce the problem of N+1 to (N/K) + 1 where K refers to the size of the batch.
  • Subselect the FETCHING strategy
  • As LAST resort, try to avoid or disable lazy loading altogether.


Discussion

No Comment Found