On Wed, Mar 02, 2016 at 09:21:03AM -0800, [email protected] wrote:
> 
> 
> On Wednesday, March 2, 2016 at 6:11:32 PM UTC+1, Dan Tagg wrote:
> >
> > if your aren't counting or averaging then why are you grouping?
> >
> >
> >
> To fast find distinct values within big dataset - some queries on some 
> engines may be faster when using grouping. 
> It was known technique years ago and I'm still using it.

As far as I know, reasonable SQL engines require that every selected
column is either in GROUP BY, or wrapped in an aggregation function
(and on those that don't enforce this rule, the result contains
arbitrary values). I fail to see how a query like this could map to
model instances.

Perhaps if you could provide a more specific example of what kind of
query you're trying to build here?

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.

Cheers,

Michal

-- 
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/20160303132736.GD960%40koniiiik.org.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Digital signature

Reply via email to