Index

Module 01 · Database InternalsOne Database, to the Bolt

Build a lock manager and deadlock detector

Locks, Latches & Transactions
Locks, Latches & Transactions · Open board

The queues of transactions waiting on each other, drawn next to the engine’s split-second latches. This lesson builds the first half: the table that says who holds what, who is waiting, and who has to give up.

Before you start. Locks, Latches & Transactions taught strict two-phase locking, the wait-for graph and a forced deadlock on a real Postgres. The Database That Won't Answer showed a lock queue freezing an app. Transactions (MVCC) built snapshots, which avoid locks for readers, and said row locks were not built. This lesson builds them. A graph with a cycle is the only idea from Graphs (BFS, DFS, Dijkstra, topological sort) you need. The code is in teaching/code/database-internals/04-locks.

Continue reading with a plan

The first three lessons of every track are free. This lesson is included with a plan, which unlocks every lesson, board, video, lab and paper for one price.

View plans →Already a member? Sign in

Related paper

Review Database Internals →

Saved in this browser, and to your account when you sign in.