Florian Pflug <fgp@phlo.org> wrote:
> Oh, cool. I thought the opt-out only works for explicitly
> DEFERRABLE transactions.
Basically, if there is no serializable read-write transaction active
which overlaps the read-only transaction and also overlaps a
serializable transaction which wrote something and committed in time
to be visible to the read-only transaction, then the read-only
transaction's snapshot is "safe" and it can stop worrying about SSI
logic. If these conditions happen to exist when a read-only
transaction is starting, it never needs to set up for SSI; it can
run just like a REPEATABLE READ transaction and still be safe from
serialization anomalies. We make some effort to spot the transition
to this state while a read-only transaction is running, allowing it
to "drop out" of SSI while running.
The fact that a read-only transaction can often skip some or all of
the SSI overhead (beyond determining that opting out is safe) is why
declaring transactions to be READ ONLY when possible is #1 on my
list of performance considerations for SSI.
-Kevin