The N + 1 Select problem arises due to an internal data store call made by any ORM framework to perform a single operation. The problem could be outlined as follows:
- A list of entities was returned that will be further iterated to perform some additional operation.
- Assuming a navigational property is accessed inside the iteration:
- Each time an iteration tries to access the navigational property, a database hit occurs
- The hits will happen N times for N number of items returned in the first step
- This makes the application perform N+1 Select (N for the iterations and 1 for the first call that retrieves the list), which should have been performed in a single database call.
This behavior is often termed as lazy loading ...