1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #18702 -- Removed chunked reads from QuerySet iteration

This commit is contained in:
Anssi Kääriäinen
2012-08-02 00:09:26 +03:00
parent ea9a0857d4
commit 70679243d1
3 changed files with 56 additions and 156 deletions

View File

@@ -524,6 +524,25 @@ non-standard behavior has been preserved but moved to the model form field layer
and occurs only when the associated widget is
:class:`~django.forms.SelectMultiple` or a subclass.
QuerySet iteration
~~~~~~~~~~~~~~~~~~
The ``QuerySet`` iteration was changed to immediately convert all fetched
rows to ``Model`` objects. In Django 1.5 and earlier the fetched rows were
converted to ``Model`` objects in chunks of 100.
Existing code will work, but the amount of rows converted to objects
might change in certain use cases. Such usages include partially looping
over a queryset or any usage which ends up doing ``__bool__`` or
``__contains__``.
Notably most database backends did fetch all the rows in one go already in
1.5.
It is still possible to convert the fetched rows to ``Model`` objects
lazily by using the :meth:`~django.db.models.query.QuerySet.iterator()`
method.
Miscellaneous
~~~~~~~~~~~~~