Cianplan

Level 2: Data · L2.4 Transactions & isolation

Locks vs optimistic concurrency

Choose pessimistic locks or version checks for a booking system.

12 min · Pro

What you take away

  • Pessimistic locking takes the row before doing the work, so conflicting transactions wait instead of failing.

And 3 more inside the class, in Pro.

How the class is laid out

  1. The problem
  2. The simple version
  3. The optimistic path, precisely
  4. Check your understanding