Skip to content

Unnecessary DB queries for API Endpoints #19692

Open
@JCWasmx86

Description

@JCWasmx86

Deployment Type

Self-hosted

NetBox Version

v4.3.2

Python Version

3.12

Steps to Reproduce

  • For each of these endpoints:
    • api/ipam/services
    • api/ipam/vlan-groups
    • api/virtualization/clusters
  • Create a few objects of each type and enable e.g. the Django debug toolbar to count the number of queries
  • Note the number of queries
  • Add a few more objects

Expected Behavior

  • Number of DB queries stays roughly the same (Like e.g. for the devices endpoint)

Observed Behavior

  • Number of queries increases by roughly the same number as the number of objects added (I guess some prefetch_related/select_related are missing)

Service: One query per parent
VLAN-Group: One query per scope
Cluster: One query per site

Metadata

Metadata

Assignees

Labels

severity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions