-
Notifications
You must be signed in to change notification settings - Fork 177
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
MPP-3927: Pre-fetch profile for domain address #5179
Conversation
The API for domain address uses the subdomain on the Profile to construct the full domain address. Previously, this required 1 query to get all the domain addresses, then 2 queries _per address_ to get the subdomain. So, a user with 100 domain addresses would use 201 queries to get their list of addresses when they visited the dashboard. With this change, the user and profile query is done once, so a user needs 1 query if they have no domain addresses, and 3 total queries for any number of domain addresses. The relay addresses API does not use user or profile data, so it continues to use 1 query for any number of addresses.
Looking into the test failures |
Figured it out. The |
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.
praise: dang, nice investigation and fix! thanks for aligning the request IDs across all the services too.
api/tests/emails_views_tests.py
Outdated
Second query: {"sql": "SELECT id, ..."}A | ||
""" | ||
|
||
# The sqlcommenter middleware records queries twice for sqlite |
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.
suggestion (non-blocking): this comment is redundant after the doc-block above
# The sqlcommenter middleware records queries twice for sqlite | |
# The sqlcommenter middleware records queries twice for sqlite |
The API for domain address uses the subdomain on the Profile to construct the full domain address. Previously, this required 1 query to get all the domain addresses, then 2 queries per address to get the subdomain. So, a user with 100 domain addresses would use 201 queries to get their list of addresses when they visited the dashboard. This may contribute to some users getting a 30 second timeout when viewing the dashboard.
With this change, the user and profile query is done once, so a user needs 1 query if they have no domain addresses, and 3 total queries for any number of domain addresses.
The relay addresses API does not use user or profile data, so it continues to use 1 query for any number of addresses.
How to test: