Skip to content
Ameen Abozaid
Planned lessonMID-014-L02

Row versions and snapshots

  • Lesson 2 of 5
  • Mid-level
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

explain visibility using xmin, xmax, and snapshots.

Planned topics

  • Every row version (tuple) stores xmin (transaction that created it) and xmax (transaction that deleted or replaced it).
  • A snapshot lists which transactions are committed from the viewpoint of a statement or transaction.
  • A version is visible if its creator is committed in your snapshot and its deleter is not.
  • Under READ COMMITTED a snapshot is taken per statement; under REPEATABLE READ once per transaction.
Draft outline details

Demonstration

sql
SELECT xmin, xmax, ctid, * FROM product WHERE id = 1;

Run before and after an update in another session; point at the changed xmin and ctid.

Check your understanding

What does xmax hold on a live row that nobody has touched?

Show answer

Zero; no deleting transaction.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.