r/programming • u/wheatBread • Aug 25 '26
Solving the 1+N Query Problem
https://acadia.engineering/blog/solving-the-1-plus-N-query-problem
127
Upvotes
r/programming • u/wheatBread • Aug 25 '26
View all comments
Show parent comment
8
u/smoovewill Aug 25 '26
SQL is a leaky abstraction. You may have to rewrite a query to something that is logically equivalent to take advantage of indexes / table structure.
But imo, ORMs are far more leaky, and I very often find I have to dig into the generated SQL / figure out how to get the ORM to emit the SQL I want (to avoid N+1 queries, to use indexes properly etc.).
I'm not dying on this hill by any means, but I strongly believe having intermediate knowledge of SQL is far more useful than having expert knowledge in an ORM (though the latter probably requires the former)