what is values_list in django orm

 Test.objects.all()                                  time: 0.010061947107315063
 Test.objects.all().values('first')                  time: 0.00578328013420105
 Test.objects.all().values_list('first')             time: 0.005257354974746704
 Test.objects.all().values_list('first', flat=True)  time: 0.0052023959159851075
 Test.objects.all().only('first')                    time: 0.011166254281997681

Here is what the above code is Doing:
1. Creating a Test model with a single field, first.
2. Creating a bunch of Test objects.
3. Timing how long it takes to retrieve all the Test objects.
4. Timing how long it takes to retrieve all the Test objects’ first fields.
5. Timing how long it takes to retrieve all the Test objects’ first fields as a list.
6. Timing how long it takes to retrieve all the Test objects’ first fields as a flat list.
7. Timing how long it takes to retrieve all the Test objects’ first fields as a queryset.

The results are:
1. Retrieving all the Test objects takes 0.010061947107315063 seconds.
2. Retrieving all the Test objects’ first fields takes 0.00578328013420105 seconds.
3. Retrieving all the Test objects’ first fields as a list takes 0.005257354974746704 seconds.
4. Retrieving all the Test objects’ first fields as a flat list takes 0.0052023959159851075 seconds.
5. Retrieving all the Test objects’ first fields as a queryset takes 0.011166254281997681 seconds.

So, retrieving all the Test objects’ first fields as a queryset is actually slower than retrieving them as a list.

The moral of the story is: if you’re only retrieving a few fields from a model, it’s faster to use values() or values_list() than it is to use only().