menu_book Technical Definition
Conflict Serializability is a property of a schedule (a sequence of operations from multiple transactions) that guarantees the final state of the database is consistent, equivalent to some serial execution of the transactions.
A schedule is Conflict Serializable if it can be transformed into a serial schedule by swapping non-conflicting adjacent operations.
The Golden Rule of Conflict
Two operations Oi and Oj are said to be in conflict if and only if they satisfy ALL three conditions:
- They belong to different transactions (e.g., T1 and T2).
- They access the same data item (e.g., both access A).
- At least one of them is a Write operation.
Conflict Types (The "Bad" Pairs)
-
RW
Read-Write
Unrepeatable Read
-
WR
Write-Read
Dirty Read
-
WW
Write-Write
Blind Write / Overwrite
Visualizing Conflicts
Precedence Graph Interactive Lab
The standard test for conflict serializability is building a Precedence Graph. If the graph has a Cycle, the schedule is NOT serializable. If it has No Cycle (DAG), it IS serializable.
list_alt Schedule Operations
Step through operations to find conflicts.
hub Precedence Graph
psychology Interview Cheat Sheet
Q: Why do we care about Conflict Serializability? expand_more
Q: What is the Precedence Graph method? expand_more
It's an algorithm to test for conflict serializability:
- Create a node for each committed transaction.
- Draw an edge Ti → Tj if an operation in Ti conflicts with and precedes an operation in Tj.
- If the graph has a cycle, it is NOT conflict serializable.
- If there is no cycle, a topological sort gives the equivalent serial order.
Q: Is every Serializable schedule Conflict Serializable? expand_more
NO.
Conflict Serializability is a subset of View Serializability (and general Serializability). There are schedules (like "Blind Writes") that are View Serializable but NOT Conflict Serializable. However, Conflict Serializability is the one most databases actually implement (via Two-Phase Locking or Timestamp Ordering) because it's computationally cheaper to check (O(N2)) compared to View Serializability (NP-Complete).