I have a Django application.
Solely in terms of ORM/query/DB performance, are the following ways of retrieving an object equivalent (i.e. in a situation where there was just a single
owner_id = pk
Since you are using the Foreign key,
filter() will give the same performance.
How you see
objs = Car.objects.get(owner_id=pk)
get() is actually implemented by Django
objs = Car.objects.filter(owner_id=pk) if len(objs) == 1: obj = objs else if len(objs) > 1: # Multiple objects returned else: # we have no object! do something pass
For your case, I would recommend using
you can be sure that only one element is returned
it is designed for this purpose