prefetch participant and voter counts in contributor index#2714
Open
Kakadus wants to merge 1 commit intoe-valuation:mainfrom
Open
prefetch participant and voter counts in contributor index#2714Kakadus wants to merge 1 commit intoe-valuation:mainfrom
Kakadus wants to merge 1 commit intoe-valuation:mainfrom
Conversation
4687711 to
01d64f2
Compare
Member
richardebeling
left a comment
There was a problem hiding this comment.
Lgtm. Can you add a test that asserts that we have < N queries? (I would assume that, for each relation we currently prefetch_related, the test fails if we remove it).
Comment on lines
+82
to
89
| ).prefetch_related( | ||
| "course", | ||
| "course__evaluations", | ||
| "course__programs", | ||
| "course__type", | ||
| "course__semester", | ||
| "course__responsibles", | ||
| ) |
Member
There was a problem hiding this comment.
Some of these could be select_relateds (course, course__type, course__semester). You could check whether it improves anything, if yes, we can use that
niklasmohrin
approved these changes
May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
relates to #1229
Directly reduces n database hits.
When testing with 200 evaluations 10 times, the accumulated test-runtime was reduced from 50s to 44s on my laptop. Even with 10 evaluations, I see a speedup (4.820s -> 3.689s).