Skip to content

N+1 problem in dcim/ipam API calls #19309

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

Open
Tishka17 opened this issue Apr 24, 2025 · 1 comment · May be fixed by #19304
Open

N+1 problem in dcim/ipam API calls #19309

Tishka17 opened this issue Apr 24, 2025 · 1 comment · May be fixed by #19304
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@Tishka17
Copy link
Contributor

Deployment Type

Self-hosted

NetBox Version

v4.2.8

Python Version

3.10

Steps to Reproduce

  1. Enable SQL logging
  2. Do API requests:
  • api/ipam/ip-addresses/
  • api/ipam/prefixes
  • api/dcim/interfaces

Expected Behavior

All required data is loaded by batch SQL requests

Observed Behavior

In the output you will see repeated SQL calls for each object in the response set:

  • circuits_virtualcircuittermination for interfaces
  • dcim_interface folowing by dcim_device for ip-address
  • dcim_site for prefixes
@Tishka17 Tishka17 added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Apr 24, 2025
@Tishka17
Copy link
Contributor Author

I understand that PR was not recommended to create, but I needed these changes to validate my hypotesis.

@bctiemann bctiemann added status: accepted This issue has been accepted for implementation severity: low Does not significantly disrupt application functionality, or a workaround is available and removed status: needs triage This issue is awaiting triage by a maintainer labels Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants