Write Skew


Last Updated on Feb 18, 2021

Write Skew is a race condition that can occur between concurrent writes. A Write Skew is neither a Dirty Write nor a lost update because the two transactions end up updating different objects. It is a race condition because if the two transactions were to run one after the other serially, they would end up making different decisions.

Instances of Write Skew follow a similar pattern:

  • A SELECT query checks whether some condition is satisfied by searching for objects/rows that match some specific search criteria.
  • The application takes a decision on how to continue depending on the result of the first query.
  • If the business logic gives a go-ahead, the application makes a write (INSERT, UPDATE, or DELETE) to the database and commits the transaction.

Traditional ways of breaking the race condition, like Atomic Writes and Explicit Locks, don't work with Write Skews because multiple objects are involved. Automatically preventing write skew requires true Serializable Isolation. This means that all transactions are forced to run serially.


© 2022 Ambitious Systems. All Rights Reserved.