Skip to content

Conversation

@p-r-a-v-i-n
Copy link
Contributor

I noticed that DRF mentions N+1 problems briefly in a note under get_queryset(), but it doesn’t give any proper explanation or examples.

I added a new section about performance and N+1 queries. It explains why the issue happens and how to use select_related and prefetch_related in get_queryset() for generic views and viewsets. I also included short examples.

The goal is to make it clearer for new people and avoid confusion.

drf-doc-3

Copy link
Collaborator

@browniebroke browniebroke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I left a few minor suggestions

@p-r-a-v-i-n p-r-a-v-i-n force-pushed the docs/performance-nplus1-optimization branch from 27fa551 to 515c434 Compare October 20, 2025 15:33
@p-r-a-v-i-n
Copy link
Contributor Author

p-r-a-v-i-n commented Oct 20, 2025

Looks good, I left a few minor suggestions

@browniebroke Thanks !
I’ve applied the suggested changes. Please let me know if anything else is needed.

@auvipy auvipy merged commit 653343c into encode:main Oct 20, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants