Closed johnbaldwin closed 4 years ago
Merging #226 into master will decrease coverage by
0.04%
. The diff coverage is87.50%
.
@@ Coverage Diff @@
## master #226 +/- ##
==========================================
- Coverage 91.33% 91.28% -0.05%
==========================================
Files 38 38
Lines 1950 1951 +1
==========================================
Hits 1781 1781
- Misses 169 170 +1
Impacted Files | Coverage Δ | |
---|---|---|
figures/pipeline/enrollment_metrics.py | 98.36% <87.50%> (+0.02%) |
:arrow_up: |
figures/sites.py | 66.27% <0.00%> (-1.17%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update d96dd9b...d596ffa. Read the comment docs.
This commit should dramatically improve the query performance for the enrollment metrics pipeline
What was wrong?
Queries were very slow because of a 'LMIT 1' issues with MySQL. For a starting point, see here
In Django, we were doing a filter query that returns a single record or
None
. Examples:Query functions such as
latest
,first
,last
and so on add aLIMIT 1
to the underlying SQL query, which has apparent negative performance on the query analyzerTo address this, we do two things
Also, LearnerCourseGradesMetrics queries are slow as the model needs indexing on fields including site, course, and learner. We address this twofold
This commit performs #2 above to then filter from this queryset to find LearnerCourseGradeMetrics records for the specified learner in the course
Enrollment Metrics tests have been updated to reflect changes in the production code