Skip to content

Conversation

@kkthxbye-code
Copy link
Contributor

Fixes: #9374

Running count on the annotated query for loading config_context is slow. The custom paginator removes the annotation before getting the count.

Testing with 35k devices loading the devices list via. the API improved load times from ~3200 ms to ~1600 ms.

This doesn't fix the underlying issue in that the query config_context annotation is slow in general and scales with the number of devices, regardless of number of records fetched.

Running count on the annotated query for loading config_context is slow. The custom paginator removes the annotation before getting the count.
@jeremystretch
Copy link
Member

This doesn't fix the underlying issue in that the query config_context annotation is slow in general and scales with the number of devices, regardless of number of records fetched.

I don't know that we can consider this a bug frankly, since it's more of an optimization issue. The fix your provided here works great to address the most obvious issue, and IMO resolves #9374.

We should probably look into implementing this more widely across the application, as there are instances where other queries could be sped up by shedding annotations from their COUNT() statements. I'll open a separate housekeeping item to pursue that once this has been tested more widely.

@jeremystretch jeremystretch merged commit 87a9cc0 into netbox-community:develop Jun 17, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2022
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.

REST response time does not scale properly with limit param while including config_context

2 participants