1👍
Not every Model.objects.all()
results in evaluating all items. QuerySets in Django are lazy evaluated. If you are not doing stupid things like len(Model.objects.all())
which evaluates it right now, you probably do not end with those evaluations. At least not always – e.g. all paginators limits querysets and so on.
One of the most RAM consuming things in Django I experienced was when displaying select box in admin consisting of hundreds of thousands possible related objects… (ant that is why raw_id_fields
are available).
Source:stackexchange.com