Re: Improve queries on django admin

2016-07-22 Thread Rael Max
Hi Lucas, thanks for reply

I think that select_related gives a great improve on performance but we can 
improve his usage passing the columns that we want retrieve, avoiding 
getting most columns/data and allocate more memory than necessary.

Em quinta-feira, 21 de julho de 2016 17:01:00 UTC-3, Lucas Magnum escreveu:
>
> You can use `list_select_related` for Django Admin too.
>
>
>
>
> []'s
>
> Lucas Magnum.
>
> 2016-07-21 15:52 GMT-03:00 Rael Max <ozkon...@gmail.com >:
>
>> Hi everyone,
>>
>> I'm working in a project with a large mysql database and i've faced with 
>> problems generated on django admin list. Basically, the query executed to 
>> retrieve a list of items from a model uses a SQL SELECT passing a list of 
>> all attributes of model, but usually we only use a small set of them on 
>> *list_display* attribute.
>>
>> I solved this problem overriding the *queryset* method of *ModelAdmin* 
>> and using the method only of *QuerySet* using the fields listed on 
>> *list_display* attribute of *ModelAdmin*. With the limit of columns 
>> retrieved this queries should to consume less memory to be executed.
>>
>> Searching about this here and on django issue tracker i've not found 
>> nothing about. What you think about this optimization be the default 
>> behavior or use a *ModelAdmin* attribute to enable?
>>
>> Regards,
>> Rael
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-develop...@googlegroups.com .
>> To post to this group, send email to django-d...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-developers.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-developers/0fab70ef-2217-4069-9f37-2ec2376626c6%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-developers/0fab70ef-2217-4069-9f37-2ec2376626c6%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/98c1dc46-9544-4752-b4dc-d0c94b3687bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Improve queries on django admin

2016-07-21 Thread Rael Max
Hi everyone,

I'm working in a project with a large mysql database and i've faced with 
problems generated on django admin list. Basically, the query executed to 
retrieve a list of items from a model uses a SQL SELECT passing a list of 
all attributes of model, but usually we only use a small set of them on 
*list_display* attribute.

I solved this problem overriding the *queryset* method of *ModelAdmin* and 
using the method only of *QuerySet* using the fields listed on 
*list_display* attribute of *ModelAdmin*. With the limit of columns 
retrieved this queries should to consume less memory to be executed.

Searching about this here and on django issue tracker i've not found 
nothing about. What you think about this optimization be the default 
behavior or use a *ModelAdmin* attribute to enable?

Regards,
Rael

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/0fab70ef-2217-4069-9f37-2ec2376626c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.