If I don't need to use cascade
/restrict
and similar constraints in a field which would logically be a foreign key
, do I have any reason to explicitly declare it as a foreign key
, other than aesthetics?
Wouldn't it actually decrease performance, since it has to test for integrity?
edit: to clarify, I don't need it since:
- I won't edit nor delete those values anyway, so I don't need to do
cascade
and similar checks - Before calling
INSERT
, I'll check anyway if the target key exists, so I don't needrestrict
checks either
I understand that this kind of constraint will ensure that that relation will be still valid if the database becomes somehow corrupted, and that is a good thing. However, I'm wondering if there is any other reason to use this function in my case. Am I missing something?