3 ms·
What? Why would enforced consistency be less worth at bigger scale? My guess would have been the complete opposite.
by yxhuvud 9y ago
What? Why would enforced consistency be less worth at bigger scale? My guess would have been the complete opposite.
- sjansen 9y agoIt's not a question of worth but feasibility. Just like an ideal schema is fully normalized, but performance concerns sometimes drive denormalization. When foreign keys can't be used to enforce data integrity, the application has to be built to compensate in other ways. Sometimes that means simply accepting dirty data, and designing the application to stay robust when encountering unexpected data. Other times it means building alternate solutions to discover and repair data issues.
- sciurus 9y agoshlomi-noach linked to https://github.com/github/gh-ost/issues/331 https://github.com/github/gh-ost/issues/331 in another comment. That goes into some of the reasons to avoid foreign keys. At a past job where we had a complex MySQL setup, I set up a slack autoresponse to post "Just say no!" anytime someone mentioned foreign keys. :-)