Question about MVCC caveats

Started by Jim Nasby5 months ago2 messagesgeneral
Jump to latest
#1Jim Nasby
Jim.Nasby@BlueTreble.com

At [1], the docs state that table rewrite ALTERs result in the relation
appearing empty after the ALTER if another transaction had already taken a
snapshot before the ALTER. A simple test with a repeatable read (or
serializable) transaction confirms this... but is there any other situation
where a snapshot would be taken?

1: https://www.postgresql.org/docs/current/mvcc-caveats.html

#2Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Jim Nasby (#1)
Re: Question about MVCC caveats

On Thu, 2025-11-13 at 13:30 -0600, Jim Nasby wrote:

At [1], the docs state that table rewrite ALTERs result in the relation appearing
empty after the ALTER if another transaction had already taken a snapshot before
the ALTER. A simple test with a repeatable read (or serializable) transaction
confirms this... but is there any other situation where a snapshot would be taken?

Snapshots are taken at the start of a statement (or, with REPEATABLE READ and
SERIALIZABLE) at the beginning of the first statement in the transaction.

What do you mean with an "other" situation?

Yours,
Laurenz Albe