Hacker News new | ask | show | jobs
by solatic 1164 days ago
Proper NoSQL design has a different perspective, it asks you "well, so what if you have an anomaly?". One example could be movies, with actors, producers, genres, etc. that could all be in separate tables in a relational database, or each movie could be a document in a document database. Now let's imagine that an actor changes their name a few years after the movie is released. Is it important to go back and change the name of the actor in each of the movies? Maybe, maybe not. Certainly you can't change the credits inside the movie itself. Maybe it's sufficient to just have a link to the actor's page, where the actor's up-to-date name is. Maybe it's insufficient if the actor will get upset that their name wasn't updated across their old movies.

You choose relational models when anomalies are unacceptable and non-relational models when anomalies are acceptable.

2 comments

That makes sense. I tend to go away from non-relational models for this reason, but it's definitely a matter of risk management.
Thanks! That is a very useful example.