thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Data & Analytics · Advanced

N+1 Query Problem

A performance anti-pattern that runs one query to fetch N parent rows and then N more queries to fetch each one's children.

Definition

It usually comes from lazy loading in ORMs and adds round-trip latency. The fix is eager loading or a single join or IN query.

Exam tip

Fix N+1 with a join or batched IN query, not with more caching.

Related terms