Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 01 · Database Internals · One Database, to the Bolt · with code: Go · about 14 min to read

Play it as a journeyTutor comes with a plan

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.

Lesson 23 of 26 in Database Internals

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • June 1971: a survey with two tasks and one disk
  • Three jobs for a lock table
  • Five schedules

Terms it explains: holders, queue.

Related paper

Review Database Internals