Why N+1 Queries Are a Natural Result of Lazy Loading
N+1 is lazy loading repeated across a collection. This RailsRevelry article traces the per-owner association load path, the relation.loaded? versus association(:invoices).loaded? distinction, preload/eager_load/includes, why preloading doesn’t fix count or scoped reads, and strict_loading as enforcement.
https://railsrevelry.substack.com/p/n-plus-one-queries-lazy-loading?r=4jsb
Post a comment