Skip to content

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Aug 14, 2025

When using Version.filter(project=project), django will re-fetch the project for each version when accessed, but when using project.versions django will share the same project instance on each version, so fewer queries and less memory is used. I checked and all querysets in public make use of self.filter, so everything should work properly.

There are probably more querysets that can benefit from a similar change, but this is just a start.

@stsewd stsewd requested a review from a team as a code owner August 14, 2025 19:43
@stsewd stsewd requested a review from agjohnson August 14, 2025 19:43
@humitos
Copy link
Member

humitos commented Aug 15, 2025

Can we document this somehow? I'm sure we will be tempted to re add the project= argument we are removing now and use the slow version of the query again.

@stsewd stsewd moved this to Needs review in 📍Roadmap Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs review
Development

Successfully merging this pull request may close these issues.

2 participants