-
Notifications
You must be signed in to change notification settings - Fork 4
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
PCR optimize instructor's course query #504
base: master
Are you sure you want to change the base?
Conversation
@@ -372,6 +373,8 @@ def check_instructor_id(instructor_id): | |||
"difficulty", | |||
] | |||
|
|||
# TODO: remove before merging into prod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commenting here as reminder
@@ -446,6 +490,7 @@ def instructor_reviews(request, instructor_id): | |||
courses_res = dict() | |||
max_sem = dict() | |||
for r in courses.values(): | |||
print(r) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rm
Is the idea behind this PR to remove some of the python logic that gets max sem and port over to SQL? Why do we see these performance issues to begin with? We are caching pages for 1 month as per Have you spoken to your friend about scraping our data? I worry we're seeing some interference here |
Yeah -- he's not doing any scraping |
Not it's changing the output query logic (e.g., you can try flipping the toggle and looking at the generated SQL queries. The ones output by the current query logic are really complex, and these ones are faster to execute by the postgres query engine. |
This PR aims to optimize the query (in postgres) that aggregates reviews for an instructor's courses.