Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#33046 closed Cleanup/optimization (fixed)

Fully cached result approach of the QuerySet.count is not documented.

Reported by: Can Sarıgöl Owned by: Can Sarıgöl
Component: Documentation Version: 3.2
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

there is no document for count function docstring.

def count(self):
        """
        ...

        If the QuerySet is already fully cached, return the length of the
        cached results set to avoid multiple SELECT COUNT(*) calls.
        """


Change History (4)

comment:1 by Carlton Gibson, 3 years ago

Component: UncategorizedDocumentation
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

Hey Can! You want to add a note something like, If the queryset has already been fully retrieved, count will use that length rather than perform an additional query to the count() reference? Sounds OK, yes.

comment:2 by Mariusz Felisiak, 3 years ago

Has patch: set
Owner: changed from nobody to Can Sarıgöl
Status: newassigned
Triage Stage: AcceptedReady for checkin

comment:3 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

Resolution: fixed
Status: assignedclosed

In 7ea8607:

Fixed #33046 -- Added note about using length of cached result by QuerySet.count().

comment:4 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

In 69009f49:

[3.2.x] Fixed #33046 -- Added note about using length of cached result by QuerySet.count().

Backport of 7ea86076fc1128d43b47f4826cb25eb5ebb19f19 from main

Note: See TracTickets for help on using tickets.
Back to Top