#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 Changed 8 years ago by
Has patch: | set |
---|
comment:2 Changed 8 years ago by
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Uncategorized → Bug |
I think the inaccuracy is due to the removal of "chunked reads" from QuerySet.__iter__()
in #18702 -- does that make sense?
comment:3 Changed 8 years ago by
Yes, you're right, that patch indeed appears to be the relevant one.
comment:4 Changed 8 years ago by
Triage Stage: | Accepted → Ready for checkin |
---|
comment:5 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
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.