I can't figure out how the default Django ORM processes queries like:
Model.objects.filter(foreign__field=value)
Does it make a lookup on each row, or is it smart enough to resolve the foreign field id(s) with the target value?
Or is it cheaper to make it this way?
value_temp = Foreign.objects.get(field=value)
Model.objects.filter(foreign=value_temp)
Copyright Notice:Content Author:「rush」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/26725740/django-orm-queryset-on-nested-queries