Re: synchronized snapshots
Kevin Grittner <kevin.grittner@wicourts.gov>
From: "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
To: "Florian Pflug" <fgp@phlo.org>
Cc: "Marko Tiikkaja" <marko.tiikkaja@2ndquadrant.com>, "Robert Haas" <robertmhaas@gmail.com>, "Joachim Wieland" <joe@mcknight.de>, "pgsql-hackers" <pgsql-hackers@postgresql.org>, "Tom Lane" <tgl@sss.pgh.pa.us>
Date: 2011-10-19T20:52:07Z
Lists: pgsql-hackers
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