I think the benefit of using the iterator is best explained by an example:

Without iterator:

You loop through the queryset, using each item for  whatever you're doing.
As you do this, all the items are now in your local scope, using up RAM.
If, after the loop, you should want to loop through the data again, you
can. Upside: Can re-use the data. Downside: memory usage.

With iterator:

You loop through the queryset, using each item for  whatever you're doing.
As you do this, read items are garbage-collected. If you want to loop
through the data again, you'll have to hit the database again. Upside:
Memory usage.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOzwKwGuO_Yt8ir3XaB9BaY%3DF7Y2R87tGKx6ArAtiFmL0qzDFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to