I'd like to elicit some input from the community about foreign key usage in real systems.
Where I work, for one reason or another, we hardly use foreign keys, primarily relying on vendors and applications to provide data with integrity, and for code to handle when referential integrity is broken.
Yesterday, a senior database developer colleague of mine described the use of foreign keys as "purely academic" citing that FK's provide little benefit that can't be enforced through procedural or application logic, thus freeing up database developers to affect code changes more quickly.
I have only been developing databases for about 3 years now, so my real life experiences are not sufficient to refute or concede to his point. Can anyone who has used FK's extensively (and ideally who also has experience with databases without them) lend me their thoughts on this topic?
Would you trust a person with no integrity? Thought not...
Same goes for databases with no RI constraints.
Funny you should mention this topic. I started working on a data migration project for a large UK based charity recently. Guess what I found? .... a 300GB database with no RI constraints! So my first deadline was to present an ERD of the existing database. Easy so I thought.... just point schema spy at the database and let it work it's magic. Kabooom! nothing.... have to do it all manually and try and figure out all the PKs and FKs myself. Within 5 minutes I was finding orphaned records all over the shop. Madness!
I've seen this in various places I've worked at. Front-end developers given responsibility to develop back-end database as well. It just doesn't work!
It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda. David Edwards - Media lens
Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.Howard Zinn