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

API V2: Fixed N+1 problem on /items endpoint #609

Merged
merged 1 commit into from
Nov 23, 2024

Conversation

calumbell
Copy link
Contributor

This PR goes part way to resolving #577 by setting up eager loading of nested fields on the /v2/items endpoint.

A/B testing reveals a significant increase in server response time on the Django test server:

Previous: ~1200 ms (461 SQL queries)
New: ~250 ms (19 SQL queries)

The test can be repeated by spinning up an instance of the test server and commenting out the get_queryset() and setup_eager_loading() function definitions in the ItemViewSet class

@augustjohnson augustjohnson merged commit 2b0582d into open5e:staging Nov 23, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants