Reputation: 644
I've seen this : https://groups.google.com/forum/#!topic/django-users/VEDZtuND2XM
But on that answer, Ronaldo said just about convenience not the speed of query speed.
Is there speed or performance difference between ForeignKey(unique=true) and OneToOneField?
Or is there any other advantages on using OneToOneField than ForeignKey(unique=true) ?
Upvotes: 1
Views: 269
Reputation: 2169
The general answer is no. But there is some performance difference if you doing some general stuff on reverse relations: when you use reverse relations defined via OneToOneField
you get an model instance, contrary to Manager for ForeignKey
reverse relation and as a consequence there's always a database hit - and this is costly.
Upvotes: 1