I want to take the last 10 instances of a model and have this code:
Model.objects.all().order_by('-id')[:10]
Is it true that firstly pick up all instances, and then take only 10 last ones?
Is there any more effective method?
I want to take the last 10 instances of a model and have this code:
Model.objects.all().order_by('-id')[:10]
Is it true that firstly pick up all instances, and then take only 10 last ones?
Is there any more effective method?