Row versions and snapshots
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) andxmax(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 COMMITTEDa snapshot is taken per statement; underREPEATABLE READonce per transaction.
Draft outline details
Demonstration
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.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.