I checked MySQL 8 today, and it's the same story. Does anyone know how this 
performs in MariaDB or Postgresql?

On Friday, June 29, 2018 at 11:00:33 PM UTC+2, Jakub Kleň wrote:
>
> Hi guys, I came across a problem today while testing my webapp with a full 
> migrations applied from my legacy site for the first time.
> The problem is I'm using Prefetch in my view query (get_queryset), and it 
> works fine when I just fetch it, but the problem comes with the .count() 
> query which generates sql with subqueries, and it takes really long to 
> process by MySQL.
> The nicest solution I'm thinking about would be to use 2 different queries 
> for object_list / pagination count, because for count the query would be 
> really simple, and wouldn't need the prefetches.
> I think this scenario may be pretty likely to come across also for other 
> Django users, so I'm thinking if it wouldn't be nice to have it directly in 
> Django.
> From my point of view, it seems like the implementation would be pretty 
> straightforward and easy, and I would even like to look into it and 
> contribute to the Django project if possible and if you think it would be 
> useful.
> I would like to add count_queryset param to Paginator.__init__, and def 
> get_count_queryset to MultipleObjectMixin. Happy to hear your opinions on 
> this :)
>

-- 
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/7018c157-03cc-4f94-afa3-b9cdc753f36f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to