[PR #9527] [MERGED] Partially fixes #9374 - Implement a custom paginator for DeviceViewSet to improve config_context load times #13477

Closed
opened 2025-12-29 23:19:05 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/9527
Author: @kkthxbye-code
Created: 6/13/2022
Status: Merged
Merged: 6/17/2022
Merged by: @jeremystretch

Base: developHead: fix-9374


📝 Commits (1)

  • 8ef7419 Implement a custom paginator for DeviceViewSet

📊 Changes

2 files changed (+19 additions, -1 deletions)

View changed files

📝 netbox/dcim/api/views.py (+2 -0)
📝 netbox/netbox/api/pagination.py (+17 -1)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/9527 **Author:** [@kkthxbye-code](https://github.com/kkthxbye-code) **Created:** 6/13/2022 **Status:** ✅ Merged **Merged:** 6/17/2022 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `fix-9374` --- ### 📝 Commits (1) - [`8ef7419`](https://github.com/netbox-community/netbox/commit/8ef74192ec78596788f425ac76bb162510569ea3) Implement a custom paginator for DeviceViewSet ### 📊 Changes **2 files changed** (+19 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/api/views.py` (+2 -0) 📝 `netbox/netbox/api/pagination.py` (+17 -1) </details> ### 📄 Description ### 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 23:19:05 +01:00
adam closed this issue 2025-12-29 23:19:06 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13477