Re: synchronized snapshots

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Florian Pflug" <fgp(at)phlo(dot)org>
Cc: "Marko Tiikkaja" <marko(dot)tiikkaja(at)2ndquadrant(dot)com>, "Robert Haas" <robertmhaas(at)gmail(dot)com>, "Joachim Wieland" <joe(at)mcknight(dot)de>, "pgsql-hackers" <pgsql-hackers(at)postgresql(dot)org>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: synchronized snapshots
Date: 2011-10-19 20:52:07
Message-ID: 4E9EF2270200002500042255@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Florian Pflug <fgp(at)phlo(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dan Ports 2011-10-19 20:53:18 Re: SSI implementation question
Previous Message Tom Lane 2011-10-19 20:36:41 Re: SSI implementation question