Monday, September 5, 2022

Ask HN: Do You Use Foreign Keys in Relational Databases

Ask HN: Do You Use Foreign Keys in Relational Databases
25 points by frogcoder 3 hours ago | hide | past | favorite | 13 comments
I use foreign keys quite often in my schemas because of data integrity, while my colleague has a no FK policy. His main argument is difficulties during data migrations which he frequently encounters. He rather have a smooth data migration process than having an unexpected error and abort the whole operation that the migration is only a small part of. I suspect the errors might be mainly caused by not considering data integrity at all at the first place, but I can feel his pain. To be fair, as far as I know, he never had major data problems.

He is not the only one I've met who insisted on not having FK. I've even seen large systems prohibit using JOIN statements.

Personally, I see the data integrity out weights the inconveniences, do you use FK for your systems, what are your experiences?






Applications are open for YC Winter 2023

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact



from Hacker News https://ift.tt/Y3vKgGo

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.