Skip to content

Fixes #19309: N+1 problem on /interfaces, /ip-addresses and /prefixes requests #19304

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

Merged
merged 3 commits into from
May 6, 2025

Conversation

Tishka17
Copy link
Contributor

@Tishka17 Tishka17 commented Apr 24, 2025

Fixes: #19309

In case of requesting /interfaces, /ip-addresses and /prefixes some of the fields are selected separately for each model. We should prefetch them.

@jnovinger jnovinger changed the title Fixes N+1 problem on /interfaces, /ip-addresses and /prefixes requests Fixes #19309: N+1 problem on /interfaces, /ip-addresses and /prefixes requests Apr 24, 2025
@jnovinger jnovinger self-requested a review April 24, 2025 17:50
@jnovinger jnovinger self-requested a review April 25, 2025 13:29
Copy link
Member

@jnovinger jnovinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Tishka17 , there's one change I'd like to see for IPAddressViewSet. Other than that, this looks great. Sorry for the lengthy review time!

Copy link
Member

@jnovinger jnovinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💥

@jnovinger jnovinger merged commit 145ee11 into netbox-community:main May 6, 2025
3 checks passed
@Tishka17 Tishka17 deleted the fix/nplus1_api branch May 6, 2025 17:20
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.

N+1 problem in dcim/ipam API calls
2 participants