N+1 Nightmare Busters

Today we're diving into two fantastic bug fixes that landed in Django - one preventing sneaky N+1 queries in RelatedManager with only(), and another fixing test crashes when running subset tests. Both PRs showcase the community's dedication to making Django more reliable and performant.

Duration: PT4M6S

Episode overview

This episode is a short developer briefing from Django.

It explains recent repository work in plain language.

  • Show: Django
  • Published: 2026-01-14T16:47:44Z
  • Audio duration: PT4M6S

Transcript excerpt

This excerpt keeps the crawler page concise. Listen to the episode or use the RSS feed for the full update.

Hey there, Django developers! Welcome back to another episode of the Django podcast. I'm your host, and I'm genuinely excited to share what's been happening in the Django world today, January 14th, 2026.

You know that feeling when you think your code is running smoothly, and then you discover it's been silently making hundreds of database queries behind your back? Well, today we're talking about two brilliant fixes that tackle exactly these kinds of sneaky issues that can drive us all a little crazy.

Let's start with the star of the show - PR 20495 by Samriddha9619. This one's a real performance hero, fixing issue 35442 about N+1 queries in RelatedManager when using the only() method. Now, if you've ever used only() to optimize your queries by selecting just the fields you need, you might have unknowingly walked…

Here's what was happening: when you'd use only() and exclude the foreign key field, Django's ModelIterable would try to be helpful by accessing that foreign key on the child object to populate relationships. But since that key was deferred, every single access triggered a separate SQL query. Imagine iterating over a…

The fix is actually quite elegant. Instead of blindly…

Our…

Nearby episodes from Django

  1. Automation Wins and SQLite Fixes
  2. Polish and Performance - When Small Changes Make Big Impacts
  3. Fresh Code, Fresh Style - Django's 2026 Makeover
  4. PostgreSQL Limits and Better Error Messages
  5. Model Utilities and Build Infrastructure Updates
  6. Weekly Recap - Cache Performance & Email Security
  7. Email System Checks and Form Fixes
  8. Email Security Documentation and Testing Updates