#25701: Add warning to an admin list_view if too many queries are being used
-------------------------------+--------------------------------------
Reporter: jacinda | Owner: jacinda
Type: New feature | Status: assigned
Component: contrib.admin | Version:
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Description changed by jacinda:
Old description:
> If you use a related field in a callable, 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.
New description:
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.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/25701#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.34d195097e376d35d01bcb819b85d4e7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.