It isn't that the individual queries are very slow. But that there are so
many of them. Attached is a screenshot of DjDT.
I see that I am not using a cache at all.  This was after doing a reload of
the same standard Django admin/change_form.html.


On Wed, May 13, 2015 at 1:58 PM, Tim Graham <timogra...@gmail.com> wrote:

> Are you sure it's the query that's slow and not the template rendering
> and/or JavaScript performance?
>
>
> On Wednesday, May 13, 2015 at 12:32:50 PM UTC-4, Timothy W. Cook wrote:
>>
>> I have a model with 13 M2M relations and some of those have a few
>> thousand instances.
>> This renders rather slowly in the Admin.
>>
>> Thinking about improvements I wonder if it will help to setup
>> prefetch_related queries
>>
>> https://docs.djangoproject.com/en/1.8/ref/models/querysets/#prefetch-related
>>
>> inside a  formfield_for_manytomany method?
>>
>>
>> https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_for_manytomany
>>
>> ​I haven't tried it yet and am not even sure how to go about it.  But if
>> experienced developers think it will work, I'll give it a shot.
>>
>> Thoughts? ​
>>
>>
>> ============================================
>> Timothy Cook
>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>> MLHIM http://www.mlhim.org
>>
>>   --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/58f721ad-2ee4-4016-ac6f-b48661c4ce5b%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/58f721ad-2ee4-4016-ac6f-b48661c4ce5b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 

============================================
Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3XABUDKS0AVsi4Y%3Dz%2BqBiB5veYkgM56eoeEP_3DBS7DOw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to