2026-04-17 –, AMPHITHEATRE
Configure your models to automatically prefetch related objects when needed with model field fetch modes, new in Django 6.1. This talk will cover usage, tradeoffs, and what distinguishes the "fetch peers" mode from prefetch_related() and select_related().
New in Django 6.1, model field fetch modes provide a way to avoid the deluge of queries from accessing un-fetched objects during a loop (also known as the "N+1 queries" problem). You may be familiar with how Django's prefetch_related() and select_related() methods can prevent these queries, but unlike those tools, the "fetch peers" mode does not require maintaining a list of fields to fetch. This can significantly improve project maintenance, especially when QuerySets are constructed at some distance from where they are used.
In this talk, we'll cover what's new about fetch modes, what tradeoffs are entailed, how to configure fetch modes per-model via managers, and how to use the "raise" mode to surface issues in development or put guardrails around performance-intensive sections of code (like the django-seal package).
Django Internals, DB, Rest APIs, Testing
Audience Level:Advanced
Django has been an integral part of my journey as a developer from my training in music composition and technology through to building open-source web applications. Django contributor since 2020, Django Fellow since 2025.