#33382: Different count and len result for a distinct QuerySet
-------------------------------------+-------------------------------------
Reporter: crazy | Owner: nobody
Type: Uncategorized | Status: closed
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):
* status: new => closed
* resolution: => duplicate
* component: Uncategorized => Database layer (models, ORM)
Comment:
Duplicate of #30655. Please see my
[https://code.djangoproject.com/ticket/30655#comment:2 comment]:
''"`count()` calls `SELECT COUNT(*)` (as described in
[https://docs.djangoproject.com/en/stable/ref/models/querysets/#count
docs]) **without taking ordering into account**,..."''
see also a
[https://docs.djangoproject.com/en/stable/ref/models/querysets/#distinct
note] about using `distinct()` on an ordered queryset.
--
Ticket URL: <https://code.djangoproject.com/ticket/33382#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.316878c068f20198c5c56251150a7519%40djangoproject.com.