4 ms·
This is a false alternative: The fact that there are situations when implementing referential integrity is difficult does not mean you shouldn’t do it at all.
by mkleczek 2y ago
This is a false alternative:
The fact that there are situations when implementing referential integrity is difficult does not mean you shouldn’t do it at all.
Secondly: relational model is based on logical-physical independence. Referential integrity is specified at the logical level and does not dictate any particular implementation. OTOH violating 1NF makes it impossible to even specify RI constraints.
NoSQL databases do not implement RI exactly because it is not possible to even specify it due to the lack of formal data model. And that’s not their strength but one of the many weaknesses.
The story about optimising Oracle performance by giving up data integrity is only an illustration of why you should not use Oracle :) Just use Postgres.
There is no problem with RI in Postgres as long as you remember to have an index on FK columns. Using CTEs allows you to perform data manipulation in a single statement with constraints enforced at the very end.
Similarily: giving up data integrity due to microservice architecture cargo cult is… tail wagging the dog.
- petalmind 2y ago> The fact that there are situations when implementing referential integrity is difficult does not mean you shouldn’t do it at all. > Referential integrity is specified at the logical level and does not dictate any particular implementation. OTOH violating 1NF makes it impossible to even specify RI constraints. Now we're bargaining. If referential integrity does not dictate any particular implementation, then having an application-level RI and no database-level constrains should also be acceptable. Yet this is not a common FK enthusiasts position. We just had a discussion of DSQL where a lot of people were saying things like "no FKs thus no real database". Well, I dunno.