Skip to content

fix: improve mysql query performance in instructor dashboard#208

Merged
naincy128 merged 1 commit intorelease-ulmofrom
cjoshi/COSMO2-809
Apr 10, 2026
Merged

fix: improve mysql query performance in instructor dashboard#208
naincy128 merged 1 commit intorelease-ulmofrom
cjoshi/COSMO2-809

Conversation

@jcapphelix
Copy link
Copy Markdown

Description

There is an issue as described in Jira ticket where the instructor page for a course shows 504, but the django request works well.

Datadog shows that django request works :- (Datadog link reference )

The most likely cause of this is because a MySQL query is taking long to respond. This PR tries to fix it.

Relevant slack thread :- https://twou.slack.com/archives/C04ACDVM6A1/p1773409936850749

Jira ticket

@naincy128 naincy128 changed the title [DO NOT MERGE] fix: improve mysql query performance in instructor dashboard fix: improve mysql query performance in instructor dashboard Apr 10, 2026
@naincy128 naincy128 marked this pull request as ready for review April 10, 2026 09:16
Copilot AI review requested due to automatic review settings April 10, 2026 09:16
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves instructor dashboard responsiveness by optimizing the CourseEnrollmentManager.is_small_course enrollment-threshold query that can trigger slow MySQL execution (and eventual 504s) due to default model ordering.

Changes:

  • Clears default CourseEnrollment ordering for the is_small_course query to avoid expensive ORDER BY work.
  • Replaces a sliced .count() with fetching a limited set of IDs and using len(...) to decide “small course”.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@naincy128 naincy128 merged commit b134bf3 into release-ulmo Apr 10, 2026
80 of 107 checks passed
@naincy128 naincy128 deleted the cjoshi/COSMO2-809 branch April 10, 2026 09:47
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.

3 participants