On Thursday, March 3, 2016 at 2:28:58 PM UTC+1, Michal Petrucha wrote:
>
>
> Merely based on your vague description, it seems to me that this is 
> one of the cases where you might be better off writing your SQL query 
> manually. 
>
>
Narrowing results by `filter()` is very handy, in contrast to writing raw 
sql. I need to add GROUP BY clause only.
To be honest I'm waiting for official support for SQLAlchemy in Django, 
because Django ORM is very limited.

But after a while I realized that I should verify performance differences 
between DISTINCT and GROUP BY.  Maybe today query planners are smart 
enough, so the "group by" trick can be abadoned.

The example of query is `select rel_id from some_table group by rel_id` 
(versus select distinct rel_id from some_table) 

Marcin


-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2a3a9fdb-d899-42a3-971d-315504351f6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to