Get the latest tech news
Abstraction boundaries are optimization boundaries
The N+1 query problem occurs when your application code sends one SQL query per element in a collection. The N queries are redundant; since all of the data is in the database already, a single...
However, what if we raise the abstraction boundary and make the ORM part of the language? There are other examples of this: Haskell has support for adding rewrite rule pragmas to libraries; among other things this is used to optimize list operations using stream fusion. However, this only works since Haskell is declarative / pure; the low-level operational semantics (like evaluation order) are abstracted away from the programmer, and as such are amenable to optimization.
Or read this on Hacker News