Databases

N+1 problem

Running 1 query to fetch a list and N more, one per item, when 1 or 2 were enough.

Example

Showing 100 orders with their user: 101 queries instead of 1 with a JOIN.

Test yourself: N+1 problem

SQL databases

With the N+1 problem, showing 100 orders with their user runs 101 queries.

Lessons that use it

More databases terms

All terms →

Arki, the beaver mascot

Your next interview starts with 5 minutes today.

Free on iOS and Android. Start from zero, no account needed.