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

Bugfix/incident-endpoint-performance #2788

Merged
merged 11 commits into from
Jan 10, 2023
Merged

Conversation

kevgliss
Copy link
Contributor

They query performance for /incidents is quite poor. Via nested pedantic relationships we are loading a cascading set of attributes we don't need. This PR introduced the idea of "minimal" models that try to not load any unnecessary sub-models. This along with modifying some relationships' lazy loading to use subqueries provided a 10x reduction in API response time (loading 500 incidents).

There are likely similar improvements to be back for cases and other endpoints. Should the need arise. I've removed several "nested" models that were similar to "minimal" but never actually used.

@kevgliss kevgliss added the enhancement New feature or request label Dec 21, 2022
src/dispatch/case/models.py Outdated Show resolved Hide resolved
src/dispatch/incident/models.py Show resolved Hide resolved
src/dispatch/incident/models.py Outdated Show resolved Hide resolved
@kevgliss kevgliss merged commit f3ca691 into master Jan 10, 2023
@kevgliss kevgliss deleted the bugfix/metric-performance branch January 10, 2023 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants