Skip to content

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
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 6, 2025
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.

N+1 problem in dcim/ipam API calls

2 participants