Exercise 1: Why Exactly Five Queries — Possible Solution ==================================================================== WHY FIVE QUERIES FOR A FIVE-LEVEL-DEEP PAGE ------------------------------ Per this chapter, breadcrumb_for walks up the tree one level at a time inside a while loop, and each time current is reassigned to current.parent, that access triggers its own separate database query if the parent hasn't already been loaded into memory. For a page five levels deep, the loop runs once per level on the way up to the root, so each of those five current.parent accesses fires its own query - five queries total. THE RESPONSIBLE LINE ------------------------------ Per this chapter, the line responsible is current = current.parent inside the while loop - it's the repeated, unbatched association access that produces one query per iteration instead of loading the whole chain in a single batched or joined query up front. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly explains that the while loop's repeated current.parent access is what triggers one query per tree level, and correctly identifies the exact line responsible for the N+1 pattern.