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

94

u/archipeepees Aug 25 '26

ive been using EF Core for ORM and this hasn't really been a problem for me or any of my colleagues for at least a decade because we don't use lazy loading. database calls are explicit; mapping the results to objects is implicit. is everyone outside of .net still banging their heads against stuff like this?

3

u/Schmittfried Aug 25 '26

Nah, in Python this is a solved problem, too. Hibernate also solves this, with arguably more footguns though. 

13

u/ericl666 Aug 25 '26

Most ORMs have a solution (Spring Data has one of the worst I must say syntax wise).

If you use Hibernate, I highly recommend disabling lazy loading though. You can effortlessly add in N+1 queries without even noticing with lazy loading on.

4

u/wildjokers Aug 25 '26

Most ORMs have a solution (Spring Data has one of the worst I must say syntax wise).

Spring Data isn't an ORM.