On Mon, 2007-10-01 at 15:05 +0200, Thomas Güttler wrote:
> Hi,
> 
> it is suprising, that
>     MyModel.objects.filter(....)
> does not use distinct by default. If you use related tables and OR,
> you get the same object returned several times.
> 
> Why not enable distinct() by default?

It's a lot less efficient at the SQL level, for a start, since the whole
result set has to be computed by the server before any single row can be
returned.

It's really going to be a matter of your particular usage pattern
whether duplicate results are the norm or not (I can't say that they are
in the stuff I do, for example), so we provide a way to add the overhead
if you need to. The programmer is going to be in the best position to
know whether duplicate results are to be expected or not and can thus
include .distinct() or not, as required.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to