-
Notifications
You must be signed in to change notification settings - Fork 73
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
Optimize inefficient database query in the deviation list view #1304
Conversation
Sounds very promising! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Small proposal related to the placement of defer call, though.
) | ||
# parent is prefetched because there may be multiple ancestors, and | ||
# they are needed for building the deviation's URL. | ||
.defer( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit: I think the defer call should be before the comment above, that refers to prefetch_related.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! You can merge this after you have moved the comment as Pasi suggested.
) | ||
# parent is prefetched because there may be multiple ancestors, and | ||
# they are needed for building the deviation's URL. | ||
.defer( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
The course module name is no longer queried separately for each deviation. This reduces the number of performed queries significantly. Additionally, some large unnecessary attributes are no longer loaded. Fixes apluslms#1302
4ea7eb4
to
95ed629
Compare
Description
What?
The course module name is no longer queried separately for each deviation. This reduces the number of performed queries significantly. Additionally, some large unnecessary attributes are no longer loaded.
Why?
The deviations list page loaded extremely slowly before. This should help with the problem.
Fixes #1302