Postgres MVCC
Determining visibility
Is a given row visible to a transaction with id T?
The rules are quite complicated, (see this for a simplified
version).
Some examples:
- T < xmin: Invisible. The row is from the future, (i.e., a transaction
that started after T).
- xmin ≤ T < xmax and xmin has committed: Visible. The
row was created before T, and was deleted by some
future transaction.
- xmin ≤ T and xmax = 0 and xmin is in
progress: Invisible. The row was created
before T, but the creating transaction has not
yet committed.
- xmin ≤ T = xmax: Invisible. The row was created before
T, and T deleted it.
- xmin ≤ T and xmax = 0 and xmin has
committed: Visible. The row was created before
T, and has not been deleted or updated.
|