Eliminate extraneous database queries when using "brief" API calls #4415

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

Originally created by @jeremystretch on GitHub (Dec 29, 2020).

Originally assigned to: @jeremystretch on GitHub.

Proposed Changes

Eliminate unused database queries when ?brief=True is passed. Brief mode employs a minimalist serializer (e.g. for populating dropdown lists in the UI), but does not alter the underlying queryset. These requests subsequently end up generating database queries to prefetch related objects that are not included in the response.

Justification

Eliminating extraneous queries improves performance without any change to the API data.

Originally created by @jeremystretch on GitHub (Dec 29, 2020). Originally assigned to: @jeremystretch on GitHub. ### Proposed Changes Eliminate unused database queries when `?brief=True` is passed. Brief mode employs a minimalist serializer (e.g. for populating dropdown lists in the UI), but does not alter the underlying queryset. These requests subsequently end up generating database queries to prefetch related objects that are not included in the response. ### Justification Eliminating extraneous queries improves performance without any change to the API data.
adam added the status: acceptedtype: housekeeping labels 2025-12-29 18:35:47 +01:00
adam closed this issue 2025-12-29 18:35:47 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4415