Apex › Storage & databases

When is an interleaving safe? (conflict serializability)

Databases interleave transactions for throughput, but the result must equal some serial order. Two operations conflict if they touch the same item from different transactions and at least one writes; draw a precedence graph (edge Ti→Tj when an op of Ti conflicts with a later op of Tj), and the schedule is conflict-serializable exactly when that graph is acyclic — a cycle is an anomaly like a lost update. Verified in node: acyclicity matches a brute-force search of all n! serial orders (0 mismatch over 3000 schedules). Pick a schedule and watch the graph and verdict.

More in Storage & databases