Skip to content
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

chore(api) Reduce spammy queries in ProjectSerializer #28641

Merged
merged 3 commits into from
Sep 17, 2021

Conversation

markstory
Copy link
Member

A large customer recently let us know about poor performance, and when I looked at the problematic endpoint I noticed many duplicate queries for organization information. The project.organization access emits a query. We can skip that query by loading the organizations into a map.

See https://sentry.io/organizations/sentry/discover/sentry:324cc6d1cb5545bf83f003c788272a8a/

A large customer recently let us know about poor performance, and when
I looked at the problematic endpoint I noticed many duplicate queries
for organization information. The `project.organization` access emits
a query. We can skip that query by loading the organizations into a map.

See https://sentry.io/organizations/sentry/discover/sentry:324cc6d1cb5545bf83f003c788272a8a/
@markstory markstory requested a review from a team September 16, 2021 21:19
Copy link
Member

@wedamija wedamija left a comment

Choose a reason for hiding this comment

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

Is the extra query just from accessing project.organization? If so, you can use prefetch_related_objects(item_list, "organization")

@markstory
Copy link
Member Author

Is the extra query just from accessing project.organization? If so, you can use prefetch_related_objects(item_list, "organization")

Good idea, I always forget about those functions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants