Finding and fixing an N+1 problem in the Django docs
summary
Django docs site loads a version picker that was causing 11 queries per page load (one + N), found by Sentry’s new Sentry performance issues detection; the fix is a single-line DB change using select_related to collapse those queries into one. The talk compares detection methods: Django Debug Toolbar, the n+1 Python package, DB-side tools like PG Badger, and suggests running N+1 checks on staging with realistic dumps or automated log parsing to catch hidden ORM inefficiencies.
AI-written summary · about
chapters (8)
- 0:00Introduction
- 1:10What is N+1 problem
- 6:31Fixing N+1 in ORMs
- 9:01Detecting N+1 problems
- 16:47Database-level detection
- 20:15Django docs case study
- 23:00Sentry performance issues
- 25:49Q&A
related talks
29mN+1 Problem in Django Rest Framework
26mA Related Matter: Optimizing your webapp
42mA Nice Problem to Have: Django Under Heavy Load
31mHigh Performance Django
43mOptimize Python & Django apps with Postgres superpowers
49mPrefetching for Fun and Profit
17mOff the Beaten Path: Exploring Unusual Roads to Django Performance
47mReal World Django Q&A
