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

Standards: teacher_scores query optimizations #33492

Merged
merged 7 commits into from Mar 9, 2020

Conversation

Erin007
Copy link
Contributor

@Erin007 Erin007 commented Mar 6, 2020

Querying for the progress tab is inefficient, particularly new queries for the standards tab related to TeacherScores. This causes performance problems, particularly for large sections. After issues were discovered in production, I temporarily stopped fetching standards data unless the standardsReport flag is on (#33467).

In this PR, to improve performance of the problematic queries :

  • Extracted content fromget_level_scores_for_stage_for_student and then deleted it to move database hits to TeacherScores out of loops so we only hit that table once instead of on every iteration.
  • Pass stage instead of stage.id as an argument to get_level_scores_for_stage_for_section so we don't have an additional database hit to re-fetch the stage.

I also added a test to ensure that increasing the number of students in a section doesn't increase the number of database hits and updated the TeacherScores model tests accordingly.

@Erin007 Erin007 changed the title [WIP] Standards: teacher_scores query optimizations Standards: teacher_scores query optimizations Mar 9, 2020
@Erin007 Erin007 merged commit bbcda65 into staging Mar 9, 2020
@Erin007 Erin007 deleted the speed-up-get-teacher-scores branch March 9, 2020 21:08
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.

None yet

2 participants