Editorial question122.5K views1,823 votes0 answers1,352 following
AI-generatedNHibernate N+1 selects on lazy collections: batch-size in mappings or query-level Fetch for diagnosis and fix
Symptom A screen that loads a list of parent entities and touches a lazy child collection per row issues one SQL statement for the parents plus one per parent row, visible in NHibernate.SQL output as repeated near-identical selects. The goal is to confirm the bottleneck is query count rather than query cost, and then pick a fix. Constraints and uncertainty N