Remove full table scan of VerificationDeadline. (#21119)
* Remove full table scan of VerificationDeadline. Before this commit, we were doing a full table scan of student_verificationdeadline, loading the results into a giant dict, and reading/writing that to the cache. This was fine when the code was introduced and there were dozens of courses, but now that we're over 12K courses, it's becoming a major performance issue for the Student Dashboard. This uses a subquery to the course enrollment table so that we're only ever pulling back the deadlines to a student's enrolled courses for any given request. It removes the cache access entirely.
Showing
- common/djangoapps/student/helpers.py 4 additions, 3 deletionscommon/djangoapps/student/helpers.py
- lms/djangoapps/verify_student/models.py 13 additions, 24 deletionslms/djangoapps/verify_student/models.py
- lms/djangoapps/verify_student/tests/test_models.py 1 addition, 46 deletionslms/djangoapps/verify_student/tests/test_models.py
Please register or sign in to comment