Re: Optionally using a custom queryset for Paginator and MultipleObjectMixin (ListView)

2018-06-30 Thread Adam Johnson
> > it takes really long to process by MySQL. > Which version? Subquery performance gets better in MySQL 5.6 and even more so on MariaDB. for count the query would be really simple, and wouldn't need the > prefetches. > When counting, prefetches aren't actaully executed. Check the actual SQL wi

Re: Optionally using a custom queryset for Paginator and MultipleObjectMixin (ListView)

2018-06-30 Thread Tom Forbes
Are you sure it is the prefetches that is causing this? As Adam pointed out these are correctly ignored. Annotations however are not, which can cause unnecessary work and longer execution times. i.e: Book.objects.annotate(something=Max('pages__word_count')).count() We have enough information to b

Re: Optionally using a custom queryset for Paginator and MultipleObjectMixin (ListView)

2018-06-30 Thread Jakub Kleň
After some more investigation yesterday, I found out that it isn't the prefetches and the subquery, and exactly as you write, it's annotations which generate joins, and for count() the difference is it has to go thru the whole db table, and that is slowing it down a lot. For my queryset, the no

Re: Optionally using a custom queryset for Paginator and MultipleObjectMixin (ListView)

2018-06-30 Thread Jakub Kleň
Hi, thank you for your response. I'm currently running MySQL 5.7.17, and the time difference between the queries is really big (0.006s vs 16.6s). I'm also wondering that something like this isn't handled by MySQL. On Saturday, June 30, 2018 at 1:50:48 PM UTC+2, Adam Johnson wrote: > > it takes r

Re: "Variables and attributes may not begin with underscores" error

2018-06-30 Thread Tim Graham
I think the reason is that underscore-prefixed attributes are generally considered to be private. Accessing them in templates doesn't seem like good practice. On Friday, June 29, 2018 at 6:44:56 PM UTC-4, Gregory Kaleka wrote: > > The docs do mention it on the more complete template api page >