Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#23817 closed Bug (fixed)

QuerySet evaluation docs are out of date

Reported by: Michal Petrucha Owned by: nobody
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The docs for QuerySet contain a reference to partial evaluation of queryset and a warning that explicitly calling list(qs) requires more memory than just iterating over a queryset.

As far as I can see, anytime a QuerySet is evaluated, all results are pulled from the database at once, stored in _result_cache and most list-like operations are simply proxied to this cache. This means that there is no partial evaluation going on anymore, and list(qs) simply creates a shallow copy of qs._result_cache.

Change History (7)

comment:1 by Michal Petrucha, 9 years ago

Has patch: set

I created a simple pull request (https://github.com/django/django/pull/3507) as well and while I was in there, I also added a note regarding #22503. If anyone wants to suggest a different wording, no problem.

comment:2 by Tim Graham, 9 years ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

I think the inaccuracy is due to the removal of "chunked reads" from QuerySet.__iter__() in #18702 -- does that make sense?

comment:3 by Michal Petrucha, 9 years ago

Yes, you're right, that patch indeed appears to be the relevant one.

comment:4 by Tim Graham, 9 years ago

Triage Stage: AcceptedReady for checkin

comment:5 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: newclosed

In 327df551e89a505c5756becee97c40198f38aff2:

Fixed #23817 -- Updated docs on QuerySet evaluation

Removed inaccurate info about partial evaluation after refs #18702.
Added information on modifying sliced QuerySets; refs #22503.

comment:6 by Tim Graham <timograham@…>, 9 years ago

In 614dd44d0d2e5f8f12256835c3453f420f54c3b4:

[1.6.x] Fixed #23817 -- Updated docs on QuerySet evaluation

Removed inaccurate info about partial evaluation after refs #18702.
Added information on modifying sliced QuerySets; refs #22503.

Backport of 327df551e89a505c5756becee97c40198f38aff2 from master

comment:7 by Tim Graham <timograham@…>, 9 years ago

In 593353d8af5b4b8d1a1e627712fe68ed593961d0:

[1.7.x] Fixed #23817 -- Updated docs on QuerySet evaluation

Removed inaccurate info about partial evaluation after refs #18702.
Added information on modifying sliced QuerySets; refs #22503.

Backport of 327df551e89a505c5756becee97c40198f38aff2 from master

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