-
Notifications
You must be signed in to change notification settings - Fork 415
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
fix: N+1 on segment overrides for environment-document endpoint #3512
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
# and the relevant URL to get an environment document | ||
url = reverse("api-v1:environment-document") | ||
|
||
# When | ||
with django_assert_num_queries(11): | ||
with django_assert_num_queries(13): |
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.
This number increased to 23 before I added the select related. I think the additional 2 queries are legitimate for retrieving the MV data and the segment overrides.
Uffizzi Preview |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3512 +/- ##
=======================================
Coverage 95.85% 95.85%
=======================================
Files 1097 1097
Lines 34117 34125 +8
=======================================
+ Hits 32704 32712 +8
Misses 1413 1413 ☔ View full report in Codecov by Sentry. |
Thanks for submitting a PR! Please check the boxes below:
pre-commit
to check lintingdocs/
if required so people know about the feature!Changes
Fixes an N+1 issue on environment-document endpoint caused by retrieving the environment for each segment override.
How did you test this code?
Updated the test for the environment-document endpoint to include segment overrides. Confirmed that the number of queries increased linearly with the number of segment overrides, then reduced once the new select related argument was added.