All topics / The N+1 Query Problem

The N+1 Query Problem

The ORM trap that is fast on seed data and dead in production: one query quietly becomes N+1. How to spot it and fix it.

  1. What N+1 actually is
  2. Seeing it in your logs
  3. Fixing it without over-fetching