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

Massively reduce the number of queries produced by the API /alert endpoint #2063

Merged
merged 3 commits into from
Dec 18, 2019

Conversation

lunkwill42
Copy link
Member

No description provided.

Because:
- We get to clean up a lot of code when the unresolved() filter can be
  used anwhere in the AlertHistory queryset chain.
Because:
- This method may be called several times per object in the API, but it
  never changes. Might as well cache the results.
Because:
- The alert API endpoint generates an unnecessary amount of subqueries,
  which slows things down as the number of active alerts increases.

This more than halves the number of queries involved. The biggest
obstacle left is the massive amounts of maintenance status queries,
which aren't as easily prefetched using querysets.
@lunkwill42 lunkwill42 merged commit 1495f75 into Uninett:5.0.x Dec 18, 2019
@lunkwill42 lunkwill42 deleted the bugfix/slow-alertapi branch January 12, 2022 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants