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 · about 21 min to read

Play it as a journeyTutor comes with a plan

MVCC & Vacuum

MVCC & Vacuum
MVCC & Vacuum · Open board

The board behind this lesson, following B-Tree on Disk and part of the same Database Internals, the deep-dive set series. It draws the instant a database decides which version of a row you get to see.

Before you start. The last lesson showed you the index: a wide, shallow tree of pages that finds any row in three or four page reads. This one is about what happens to the row itself once two people try to read it and write it at the same moment.

Lesson 9 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

  • Monday, July 20th, 2015: the database that stopped taking writes
  • The trick: an UPDATE writes a new version, it does not erase the old one
  • How two readers see two different truths: the snapshot
  • The bill comes due: old versions, and the VACUUM
  • The clock that ran out: wraparound

Terms it explains: version, MVCC, snapshot, VACUUM, wraparound, frozen, version chain, hint bits, fresh snapshot per statement, plus SSI, anti-wraparound vacuums.

Lab

One transaction has been open for an hour and nobody noticed. Why is the table three times the size of its data?

Press Commit next transaction to the end, then drag How long the oldest reader has been sitting there right and watch The bill.

Open The vacuum lag

Related papers

Review Database Internals