#5987: __iter__ on a QuerySet doesn't return an efficient iterator
-------------------------------------+--------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: nobody
Status: new | Component: Database wrapper
Version: SVN | Keywords: iterator __iter__
Stage: Unreviewed | Has_patch: 0
-------------------------------------+--------------------------------------
For a loop such as:
{{{
for item in Model.objects.all():
print item # or whatever
}}}
the first line eats up all system memory for sufficiently large Models.
Replacing it with Model.objects.all().iterator() improves the situation a
lot. Why doesn't __iter__ return iterator()?
(I see that __iter__ can use a cache. Is there a reason not to compute the
cache on-the-fly?)
--
Ticket URL: <http://code.djangoproject.com/ticket/5987>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---