Re:Understanding N + 1 queries problem
by jbverschoor on Monday January 02, 2023 @04:04PM
(#34223630)
No it's not. If one forehand you do not know which "object graph" you need, you'll run in this problem no matter what the underlying tech is.
At least some with ORMs you can specify afterwards (when passing the activerecords) that you want to have prefetched (inner or outer joins, caching). Sometimes it's done automatically, because you can simply detect when you're in an N+1 query loop.
At least some with ORMs you can specify afterwards (when passing the activerecords) that you want to have prefetched (inner or outer joins, caching). Sometimes it's done automatically, because you can simply detect when you're in an N+1 query loop.