N+1 Query Hunter

Detect ORM loop-of-queries (N+1) patterns from query logs and eliminate them with batched eager loading, keeping the N+1s that are cheap. Use when a list endpoint is slow, a request issues many near-identical SELECTs differing only by an id, query logs show repeated SELECTs in a loop, or a tool like the bullet gem flags an N+1 in ActiveRecord, Prisma, SQLAlchemy, or Hibernate.

SkillMedev 5191ac7 4.8 KB Updated

File contents

SkillMedev/database-performance/tree/main/skills/n-plus-one-hunter commit 5191ac7380

Frequently asked questions

npx skillmds@latest add skillmedev/n-1-query-hunter