Foreign Key Constraints Debate
The cluster centers on debates about using foreign key constraints in databases, weighing their role in maintaining referential integrity against drawbacks like performance impacts, schema migrations, and scalability issues in large apps.
Activity Over Time
Top Contributors
Keywords
Sample Comments
Database-enforced FKs are an overrated crutch anyway. Apply the third normal form, utilize transactions correctly, and you won't ever need them.
How could foreign keys ever be a "hassle"?
I take it you don't use foreign key constraints, then.
Do you not think about relational integrity?
"use FK, you fools!"FK maintains your database integrity. If you care about data, just use it !
The suggestion is to not use foreign key constraints in the database.The suggestion is not to eschew columns which might be JOINed on in a query.I.e. "Don't enforce FK relationships with a constraint in the DB. Make sure the values in both tables which may be joined are consistent by using application code to enforce this."
Sanely created schema does not have these kinds of problems ;). Plus FKs are a performance impact.
Do you know if foreign keys tend to be a problem on postgresql as well?
Yes, the one in which you considered FK constraints to be a waste of time
So you don't want support for real foreign keys?