Tech Insights
If you want the number of items in a QuerySet and are also retrieving model instances from it (for example, by iterating ove...
If you want the number of items in a QuerySet and are also retrieving model instances from it (for example, by iterating over it), it’s probably more efficient to use len(queryset) which won’t cause an extra database query like count() would.
Shared by
- Django



