Good walkthrough. Two practical notes. explain(analyze=True) actually executes the query, so for UPDATE or DELETE it is safer to run it inside a transaction you roll back. And in DRF, a SerializerMethodField that touches a relation brings N+1 back even after prefetch_related, unless the method reads the prefetched data. assertNumQueries is useful, but pinning exact counts gets brittle, so assert on one endpoint with fixed fixtures.







