Tables do not automatically prefetch reverse one-to-one relations #10072

Closed
opened 2025-12-29 21:26:32 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Aug 10, 2024).

Originally assigned to: @jeremystretch on GitHub.

Deployment Type

NetBox Cloud

NetBox Version

v4.0.8

Python Version

3.10

Steps to Reproduce

  1. Create a device with five module bays
  2. Install a module into each bay
  3. View the device's module bays list

Expected Behavior

The installed modules should be prefetched automatically to optimize the number of database queries.

Observed Behavior

A separate query is issued for each installed module. This is because the base table's prefetch logic does not recognize reverse one-to-one relations.

Originally created by @jeremystretch on GitHub (Aug 10, 2024). Originally assigned to: @jeremystretch on GitHub. ### Deployment Type NetBox Cloud ### NetBox Version v4.0.8 ### Python Version 3.10 ### Steps to Reproduce 1. Create a device with five module bays 2. Install a module into each bay 3. View the device's module bays list ### Expected Behavior The installed modules should be prefetched automatically to optimize the number of database queries. ### Observed Behavior A separate query is issued for each installed module. This is because the base table's prefetch logic does not recognize reverse one-to-one relations.
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:26:32 +01:00
adam closed this issue 2025-12-29 21:26:32 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10072