Performance: N+1 query problem
HIGH IMPACT
This affects page load speed by causing many database queries during data fetching, which delays server response and slows down rendering.
List<Order> orders = orderRepository.findAllWithCustomers(); // uses JOIN FETCH or EntityGraph // customers loaded in one query with orders
List<Order> orders = orderRepository.findAll();
for (Order order : orders) {
Customer customer = customerRepository.findById(order.getCustomerId()).orElse(null);
order.setCustomer(customer);
}| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| N+1 Query Pattern | No direct DOM impact | No direct reflows | Blocks initial paint due to slow server response | [X] Bad |
| Batch Fetching with JOIN FETCH | No direct DOM impact | No direct reflows | Faster initial paint due to quicker server response | [OK] Good |