Oct 15, 2016 Saturday

Using Django querysets effectively

To avoid populating the queryset cache, but to still iterate over all your results, use the iterator() method to fetch the data in chunks, and throw away old rows when they’ve been processed.