Hi,

Could someone please let me know what the implications of Django queryset 
iterator on select_related and prefetch_related? 

Also, I am still not quite clear on the concept of iterator which I 
understand returns a Generator. Whenever a for loop is run on the 
Generator, the DB is queried for each element in the for loop - if my 
understanding is correct. The result of the Query is not stored in the 
memory. So, for some model A,

qs = A.objects.all() which probably does 'Select "all columns/fields'" from 
A in some order". This would probably fetch the results in one go. I am not 
sure how the iterator() changes this. 

BTW I observed that the iterator doesn't work like a typical Generator. 
Repeated call with next() on the Generator produces the same value. 

Would appreciate if someone could explain the above or provide any 
reference.

Thanks.

-- 
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/252d11a2-6e49-4c5a-b466-e186cf7254af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to