[patch] Auth runs unnecessary SQL to get permissions
On each request, when the permissions are requested for a user this SQL gets executed a bunch of times, for each permission the user has:
SELECT `django_content_type`.`id`, `django_content_type`.`name`, `django_content_type`.`app_label`, `django_content_type`.`model`
FROM `django_content_type` WHERE (`django_content_type`.`id` = %s)
Could all this be done in one statement using selected_related() instead of all()? Might be worth optimizing since it's per-request.
Change History
(4)
Summary: |
Admin runs unnecessary SQL to get permissions → [patch] Admin runs unnecessary SQL to get permissions
|
Component: |
Admin interface → Contrib apps
|
milestone: |
Version 1.0
|
Summary: |
[patch] Admin runs unnecessary SQL to get permissions → [patch] Auth runs unnecessary SQL to get permissions
|
Version: |
SVN
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
patch for trunk/django/contrib/auth/models.py