Alvaro Herrera <alvherre@commandprompt.com> writes:
> Tom Lane wrote:
>> I thought of a different approach to it, which is to make snapshot
>> checking take a hint from TransactionIdIsInProgress: use the subxid
>> caches from the PG_PROC array.
> Yeah, I had thought about using the XidCache while checking your other
> approach yesterday. I was thinking however not in saving the Xids in
> the snapshot, but using the ones already in PGPROC. Not sure if that is
> as useful, but looks like at least it would be able to reduce the
> probability of examining pg_subtrans in some cases without introducing
> extra cost.
How would that work? The ones in PGPROC, by the time you are examining
the snapshot, might have little to do with the ones that were valid at
the time the snap was taken. Another problem is that (AFAICS) you'd
have to lock the ProcArray to look at them, and the whole point of this
exercise is to avoid needing to lock shared data structures during
HeapTupleSatisfiesSnapshot.
regards, tom lane