Opened 5 months ago

Closed 5 months ago

Last modified 5 months 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 Changed 5 months ago by Carlton Gibson

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 Changed 5 months ago by Mariusz Felisiak

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

comment:3 Changed 5 months ago by Mariusz Felisiak <felisiak.mariusz@…>

Resolution: fixed
Status: assignedclosed

In 7ea8607:

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

comment:4 Changed 5 months ago by Mariusz Felisiak <felisiak.mariusz@…>

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