Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track cardinality of querysel seal. #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

charettes
Copy link
Owner

This will allow to differentiate between sealed queryset that would benefit from prefetching many-to-many relationships and the ones that don't.

In other words, warning about N+1 query issues when fetching a many-to-many relationship from a singular result (.get(), .first()) is arguably bad practice as it could be beneficial to defer the fetching. This is a common scenario when seal()'ing a queryset meant to be used both by singular (detail view) and multiple results (list view) code paths.


This paves the way for addressing #44 but it will likely need to be opt-in through a setting to maintain backward compatibility.

This will allow to differentiate between sealed queryset that would benefit
from prefetching many-to-many relationships and the ones that don't.

In other words, warning about N+1 query issues when fetching a many-to-many
relationship from a singular result (.get(), .first()) is arguably bad practice
as it could be beneficial to defer the fetching. This is a common scenario when
seal()'ing a queryset meant to be used both by singular (detail view) and
multiple results (list view) code paths.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.09%) to 99.157% when pulling dbd2ec9 on seal-origin into 75c1697 on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants