#17659: django_admin_log searches are slow
--------------------------------------+------------------------------------
     Reporter:  anonymous             |                    Owner:  keeff
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  contrib.admin         |                  Version:  1.3
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  1                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  1
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Comment (by Stanislas Guerra):

 FYI,

 Without the index, the last query of the admin history page took 1350 ms
 (1,35s):
 {{{
 SELECT ••• FROM `django_admin_log` INNER JOIN `auth_user` ON
 (`django_admin_log`.`user_id` = `auth_user`.`id`) WHERE
 (`django_admin_log`.`content_type_id` = 15 AND
 `django_admin_log`.`object_id` = '144887') ORDER BY
 `django_admin_log`.`action_time` ASC LIMIT 25
 }}}

 Whereas with the following index it took 0.93 ms:

 {{{
 CREATE INDEX django_admin_log_object_id ON django_admin_log (object_id);
 }}}

 Server version: 10.11.11-MariaDB-0+deb12u1 Debian 12
-- 
Ticket URL: <https://code.djangoproject.com/ticket/17659#comment:10>
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 view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070196fdb80554-3fb4afcd-31fc-4c8e-8e3c-1810f82cc504-000000%40eu-central-1.amazonses.com.

Reply via email to