[Fixed]-Values list vs Iterating

1👍

values_list will be more performant as it will only fetch the requested fields from the database and it will not instantiate model instances.

Quoting the Django documentation:

It is useful when you know you’re only going to need values from a small number of the available fields and you won’t need the functionality of a model instance object. It’s more efficient to select only the fields you need to use.

👤aumo

Leave a comment