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

Speed up permission retrieval from the database considerably. #4

Conversation

drgrice1
Copy link

Instead of retrieving the permissions for all users with one query to the database for each user, get them all in a single query.

From the develop branch to the feature/classlist-permissions branch the timing for the load of the classlist editor page for a course with more than 18,000 users increased from 240 milliseconds to 1.69 seconds. That is a considerable slow down. The main reason for this is what is changed here. This brings the page load time back down to 549 milliseconds. Of course those timings are from one page load, but similar timings occur on repetition.

This is still twice as long as long of a load time as before. Part of this is because previously when loading a large class (more than 200 users) no permissions were loaded at first since only the permissions for visible users were loaded. Although, timing shows that with the change suggested here the user and permission queries are about the same as before. Timing further shows that the real slow down is the sorting. Previously only visible users were sorted. Now all users are sorted regardless of which are shown.

the database for each user, get them all in a single query.

From the develop branch to the feature/classlist-permissions branch the
timing for the load of the classlist editor page for a course with more
than 18,000 users increased from 240 milliseconds to 1.69 seconds.  That
is a considerable slow down.  The main reason for this is what is
changed here.  This brings the page load time back down to 549
milliseconds.  Of course those timings are from one page load, but
similar timings occur on repetition.

This is still twice as long as long of a load time as before.  Part of
this is because previously when loading a large class (more than 200
users) no permissions were loaded at first since only the permissions
for visible users were loaded.  Although, timing shows that with the
change suggested here the user and permission queries are about the same
as before.  Timing further shows that the real slow down is the sorting.
Previously only visible users were sorted.  Now all users are sorted
regardless of which are shown.
Copy link
Owner

@drdrew42 drdrew42 left a comment

Choose a reason for hiding this comment

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

Thanks for this recommendation!

@drdrew42 drdrew42 merged commit 0cb2413 into drdrew42:feature/classlist-permissions Feb 19, 2023
@drgrice1 drgrice1 deleted the feature/classlist-permissions-suggestion branch February 19, 2023 21:56
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