Use subqueries when counting multiple types of related objects #3855

Closed
opened 2025-12-29 18:31:37 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Jul 10, 2020).

Originally assigned to: @jeremystretch on GitHub.

Proposed Changes

Use the get_subquery() function to attach counts of related objects. This change is needed for:

  • Clusters
  • Device roles
  • IPAM roles
  • Manufacturers
  • Platforms

Justification

Greatly improves performance over per-object queries for related object counts.

Originally created by @jeremystretch on GitHub (Jul 10, 2020). Originally assigned to: @jeremystretch on GitHub. ### Proposed Changes Use the `get_subquery()` function to attach counts of related objects. This change is needed for: * Clusters * Device roles * IPAM roles * Manufacturers * Platforms ### Justification Greatly improves performance over per-object queries for related object counts.
adam added the status: acceptedtype: housekeeping labels 2025-12-29 18:31:37 +01:00
adam closed this issue 2025-12-29 18:31:37 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3855