NOTE

2.1 PostgreSQL Isolation Levels

1. Implementation PostgreSQL implements different database isolation levels according to when snapshots are obtained (corresponding to the GetTransactionSnapshot function in the code): - Read Uncommitted/Read Committed: each query obtains the latest snapshot CurrentSnapshotData - Repeatable Read: all queries obtain the same snapshot, which is the snapshot FirstXactSnapshot obtained by the first query - Serializable: implemented using the lock system

DatabasesCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

1. Implementation

PostgreSQL implements different database isolation levels according to when snapshots are obtained (corresponding to the GetTransactionSnapshot function in the code):

  • Read Uncommitted / Read Committed: each query obtains the latest snapshot, CurrentSnapshotData.
  • Repeatable Read: all queries obtain the same snapshot, which is the FirstXactSnapshot obtained by the first query.
  • Serializable: implemented using the lock system.

2026 note: PostgreSQL’s READ UNCOMMITTED is actually handled as READ COMMITTED; Serializable is also not implemented only with ordinary locks, but through Serializable Snapshot Isolation (SSI) together with predicate locking to detect dependencies that may break serializability.

Discussion

Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub