Re: Django ORM generate inefficient SQL

2014-08-29 Thread Alex Lebedev
I have created a ticket - https://code.djangoproject.com/ticket/23383 Should I try to proceed my investigations and create a patch? пятница, 29 августа 2014 г., 11:50:01 UTC+6 пользователь Simon Charette написал: > > I think you should create a single issue >

Re: Django ORM generate inefficient SQL

2014-08-28 Thread Simon Charette
I think you should create a single issue pointing to the fact that only selected columns (either through values() or only()) should be grouped by, regardless of the backend. I suggest you include your initial post body in the report. Thanks! Le

Re: Django ORM generate inefficient SQL

2014-08-28 Thread Alex Lebedev
Yes, I guess, in this case it should be able to group only by `auth_group`.`id` for each database backend. Should I create ticket(s) about the issue on MySQL and/or the issue of columns in "group by" statement, or would you like to do it yourself? четверг, 28 августа 2014 г., 20:36:19 UTC+6

Re: Django ORM generate inefficient SQL

2014-08-28 Thread Simon Charette
The issue on MySQL should be tracked in another ticket I guess -- you're right that it should be able to GROUP only by `auth_group`.`id`. Le jeudi 28 août 2014 07:28:18 UTC-4, Alex Lebedev a écrit : > > Thanks for the answer! Yes, but this problem occurs regardless of > database backend (I

Re: Django ORM generate inefficient SQL

2014-08-28 Thread Alex Lebedev
Thanks for the answer! Yes, but this problem occurs regardless of database backend (I tested it on PostgreSQL and MySQL) среда, 27 августа 2014 г., 12:37:00 UTC+6 пользователь Simon Charette написал: > > This is already tracked in #19259 > . > > Le

Re: Django ORM generate inefficient SQL

2014-08-27 Thread Simon Charette
This is already tracked in #19259 . Le jeudi 21 août 2014 06:49:41 UTC-4, Alex Lebedev a écrit : > > Hi, guys! > > I have encountered a problem. When I use the following code in django > shell: > > from django.contrib.auth.models import Group >

Django ORM generate inefficient SQL

2014-08-21 Thread Alex Lebedev
Hi, guys! I have encountered a problem. When I use the following code in django shell: from django.contrib.auth.models import Group from django.db.models import Count print Group.objects.annotate(cnt=Count('user')).values('id', 'cnt').query.sql_with_params() Django ORM generate