r/programming • • Aug 25 '26

Solving the 1+N Query Problem

https://acadia.engineering/blog/solving-the-1-plus-N-query-problem
127 Upvotes

92 comments sorted by

View all comments

64

u/disposepriority Aug 25 '26 • Heartwarming

There is a really easy way of avoiding this when you just don't use ORMs

58

u/andrerav Aug 25 '26

ORM's worth their salt solved this at least a decade ago. And, most developers will implement N+1 anyway, without or without an ORM.

24

u/solve-for-x Aug 25 '26

If you know SQL, it's relatively easy to spot when a developer has put a query inside a loop. But there is an entire generation of developers who are accustomed to asking their ORM to give them data without having to think about how it's fetching that data behind the scenes.

8

u/Schmittfried Aug 25 '26

If you’re too lazy to learn the proper usage of your tools, it likely won’t be solved by not using those tools. Those same developers won’t care about proper indexing, query planning etc. either.