One outer statement-budget rectangle contains work, lock-wait, work and wait blocks; separate red brackets under the waits show a timer for each acquisition.

Locks wait politely when a transaction grabs them

A lock wait can be healthy coordination or an expensive queue. PostgreSQL’s lock_timeout lets an operation stop waiting, but it does not diagnose why the holder is slow or decide whether retrying is appropriate. Choose the timeout from the operation’s latency budget, and inspect the blocking transaction before increasing the limit or multiplying attempts. ...

February 16, 2028 · 5 min · XB Field Notes
One EXEC boundary contains ordered replies OK, WRONGTYPE, OK. Both successful writes remain, and other clients do not interleave during execution.

Redis transactions isolate execution without rollback

A Redis transaction is a connection-scoped command queue followed by an isolated execution window. MULTI starts the queue; EXEC runs accepted commands in order. The useful guarantee is that another client’s commands cannot run between those operations. It is not a promise to undo successful writes when a later command fails. ...

March 31, 2027 · 6 min · XB Field Notes
Read Committed and Repeatable Read tracks both begin with reading zero and B committing an increment; their final A steps diverge to two or error 40001.

A transaction can fail and leave you to retry

A competing update does not automatically make a PostgreSQL transaction fail. The outcome depends on isolation, statement behavior, and the state another transaction commits. Treating every collision as the same retryable event can conceal invalid input or repeat a decision made from stale data. The useful boundary is a complete application operation whose reads and writes can be attempted again. ...

February 1, 2027 · 5 min · XB Field Notes
A retry loop encloses reading again, recomputing, writing and committing. Confirmed 40001 or 40P01 requires rollback, remaining budget and jitter. An unknown commit requires reconciliation before replay.

A bounded retry gives a transaction another chance

A retry can recover a transaction rejected because of concurrent work. It cannot guarantee success, and it does not automatically make external effects idempotent. The retry unit should include every database read and application decision that determined the writes. Reusing an amount calculated from the first attempt’s snapshot can defeat the purpose of starting a fresh transaction. ...

November 9, 2026 · 6 min · XB Field Notes
Two Repeatable Read transactions each see two available doctors and make a different doctor leave. Both commit, leaving zero and breaking the rule that at least one doctor must stay.

Choose transaction isolation to preserve the invariant

Choose an isolation level from the invariant an operation must preserve. A stable snapshot is useful, but two transactions can each make a locally reasonable decision that becomes invalid when both commit. PostgreSQL Repeatable Read prevents changes to a transaction’s reading snapshot, yet permits some serialization anomalies. Serializable adds detection that rejects combinations of concurrent work inconsistent with any serial execution, requiring the application to handle retries. ...

August 23, 2026 · 5 min · XB Field Notes
A retained Repeatable Read snapshot includes old row 1 and A’s own newly inserted row 3. After A commits, a fresh read includes new row 1, B’s row 2 and A’s row 3.

MVCC selects row versions through visibility rules

Multi-version concurrency control lets PostgreSQL keep different row versions and decide which ones a query may see. An ordinary reader can continue seeing an older committed version while another transaction writes a newer one. This reduces conflicts between reading and writing, but does not give every transaction one permanently frozen view. Snapshot lifetime depends on isolation, and a transaction can see its own earlier changes even when other transactions cannot. ...

August 8, 2026 · 4 min · XB Field Notes