shlogg · Early preview
Franck Pachot @franckpachot

Avoiding Update Anomalies With Embedded Documents In YugabyteDB

Serializable isolation level prevents dirty reads by ensuring that transactions see a consistent view of the database until they commit or roll back. This allows multiple transactions to access shared resources without conflicts.

In a previous post, I explained that a serializable isolation level is not the only solution to avoid write skew anomalies. Normalizing the database schema, I converted the read-write conflict into a write-write conflict. This strategy allows us to achieve serialization within the read-committed isolation level using a SELECT FOR UPDATE.
I used Martin Kleppmann's example of doctors' on-call shifts to demonstrate write skew anomalies.
Document data modeling is often confused with denormalization, but it can serve as a normalized alternative to the two-table solution, effectively avoiding write...