r/programming 7d ago

Solving the 1+N Query Problem

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

94 comments sorted by

View all comments

61

u/disposepriority 7d ago

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

59

u/andrerav 7d ago

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.

16

u/Chroiche 7d ago

They didn't solve anything. They gave you tools to solve it, but devs need to consciously use them, which they often don't. And you can chain so deep with different lazy vs eager loads all over the shop thanks to these "tools" that it becomes a total mess to know what's actually going to run.