In these cases:
qs = MyModel.objects.filter(user=user) #1
qs = MyModel.objects.filter(user_id=user.pk) #2
Both results in the same queryset using a sql query like to WHERE "my_model"."user_id" = pk
but if you use user=user
as filter, internally search for the instance pk taking a little longer than user_id=user.pk
. Maybe the logic to make sql queries for relationships is different that i think but without that “pk searching” in the 1st filter, the 2nd is a little faster?