Ask HN: Do You Use Foreign Keys in Relational Databases
35 by frogcoder | 21 comments on Hacker News.
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?
0 Comments