Diagnose and remove an N+1 query
Mid · debugging · 20 min · runtime php-cli
Brief
A booking list runs one query per row to load each resource name. Explain the cause (N+1) and give one fix, then add a regression test that fails before the fix.
3 progressive hints are available in the editor.
Public checks
- identifies N+1 — expected:
mentions per-row query and eager loading or join