Opened 9 years ago

Last modified 8 months ago

#25701 new New feature

Add warning to an admin list_view if too many queries are being used — at Version 2

Reported by: Jacinda Shelly Owned by: Jacinda Shelly
Component: contrib.admin Version: dev
Severity: Normal Keywords:
Cc: jacinda.shelly@…, Ülgen Sarıkavak Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Jacinda Shelly)

If you use a related field in a callable on a Model or ModelAdmin, and then use that callable in list_display, Django doesn't currently have a way to automatically detect that select_related should be used and performs a query for every row in the list.

While it might be possible to do this automatically, a quick way to help with this problem would be to warn a developer with something like django.contrib.messages (if enabled) that a list_view is performing O(n) queries and that they should investigate this as a potential performance issue.

Change History (2)

comment:1 by Jacinda Shelly, 9 years ago

Cc: jacinda.shelly@… added
Owner: changed from nobody to Jacinda Shelly
Status: newassigned

comment:2 by Jacinda Shelly, 9 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top