Opened 18 years ago

Closed 17 years ago

#2565 closed enhancement (fixed)

Documentation should clarify lazy nature of querysets

Reported by: Simon Willison Owned by: Jacob
Component: Documentation Version:
Severity: normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I've answered a couple of comments in the documentation recently about QuerySet lazy evaluation:

http://www.djangoproject.com/documentation/tutorial4/#c2024
http://www.djangoproject.com/documentation/models/pagination/#c2032

That's enough for me to think that this is a frequent misunderstanding. We certainly don't want people to be put off Django because they think it makes horribly inefficient queries, when the exact opposite is true!

An entry in the FAQ would be a good start, but having notes (and a link) about this behaviour in the relevant places in the docs would be smart too.

Attachments (1)

2565.diff (1.4 KB ) - added by James Bennett 17 years ago.
Patch adding an explanation that all() doesn't query

Download all attachments as: .zip

Change History (5)

comment:1 by James Bennett <ubernostrum@…>, 18 years ago

So a link from various places to this: http://www.djangoproject.com/documentation/db_api/#querysets-are-lazy might solve it?

comment:2 by Simon G. <dev@…>, 17 years ago

Triage Stage: UnreviewedAccepted

Where should this be mentioned? possibly the best place would be to have a chained filter example in tutorial 1 and a comment/link to the db-api doc.

by James Bennett, 17 years ago

Attachment: 2565.diff added

Patch adding an explanation that all() doesn't query

comment:3 by James Bennett, 17 years ago

Triage Stage: AcceptedReady for checkin

comment:4 by Jacob, 17 years ago

Resolution: fixed
Status: newclosed

(In [4637]) Fixed #2565: added a note about the laziness of querysets in tutorial 4. Thanks, Ubernostrum.

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