NOSQL datamodel data neutralization

Many times I read that data in NOSQL databases is stored denormalized. For example, consider recording in a chess game. It may contain not only the identifier of the player participating in the chess game, but also the first and last name of this player. I suppose this is done because NOSQL cannot combine, so if you just duplicate the data, you can still get all the data you need in one call without manually processing the data at the application level.

I don’t understand that now, when you want to update the name of the chess player, you will need to write a request that will update both the records of the chess game in which this player participates, and the player’s record is a player. It looks like a huge overhead, since the database will have to look for all the games in which this player participates, and then update each of these entries.

Is it true that data is often stored in denormalized, as in my example?

+5
source share
1 answer

You are right, data is often stored under normal conditions in NoSQL databases.

The problem with updates is partially related to the term “possible consistency”.

In your example, when you update a player’s name (not a common event, but it can happen), you must complete a background task to update the name in all other entries. Yes, although the update is taking place, you can get an older value, but in the end the data will be consistent. Since we are not writing ATM software here, a trade-off between performance and negotiation is acceptable.

You can find more information here: http://www.allbuttonspressed.com/blog/django/2010/09/JOINs-via-denormalization-for-NoSQL-coders-Part-2-Materialized-views

+7
source

Source: https://habr.com/ru/post/1207979/


All Articles