...

/

Serializable Snapshot Isolation

Serializable Snapshot Isolation

Database concurrency control exhibits a spectrum. On one end, we have serializable isolation that eliminates all race conditions at the cost of performance and scale, while at the other end of the extreme we have weaker forms of isolation that suffer from race conditions but perform and scale well. A compromise between the two extremes exists called Serializable Snapshot Isolation (SSI). This algorithm offers complete serializability while minimizing performance penalty compared to simple snapshot isolation. SSI uses a consistent snapshot for reads and adds intelligence on top to detect writes that violate serializable isolation and abort such transactions.

widget

SSI is based on the concept of optimistic concurrency control, which states that concurrent transactions don’t block each other while executing in the hopes that no transaction would interfere with the other. Eventually when it is time to commit, a transaction verifies that its outcome is the same as if it were to execute serially and if a violation has taken place then the transaction aborts. In contrast, pessimistic concurrency control blocks transactions from executing concurrently whenever it detects that running two or more transactions in parallel may result in race conditions. Literal serial execution of transactions is an extreme example of pessimistic concurrency control, which is akin to each transaction placing an exclusive lock on the database while it executes.

Optimistic concurrency control comes with its own pros and cons. For example, in a system with very high contention, the likelihood of concurrent transactions stepping over each other increases ...

Access this course and 1400+ top-rated courses and projects.