On 04/10/2018 05:04 PM, Chapman Flack wrote: > ... I wonder if > there's at least a cheap way to check a particular snapshot > for suitability wrt a given toast pointer. Check a couple usual > suspects, find one most of the time, fall back to eager detoasting > otherwise? > > Guess I need to go back for a deeper dive on just what constitutes > a toast pointer. I was skimming last time....
I see all I have in a toast pointer is a relation id and a value oid, so probably no way to check that a given snapshot 'works' to find it, at least no more cheaply than by opening the toast relation and trying to find it. Welp, what tuptoaster does to construct its SnapshotToast is to grab GetOldestSnapshot(): * since we don't know which one to use, just use the oldest one. * This is safe: at worst, we will get a "snapshot too old" error * that might have been avoided otherwise. ... which means, I take it, that a more recent snapshot might work, but this conservative choice would only fail if the oldest snapshot has really been around for many days, under typical old_snapshot_threshold settings? ... and if I'm getting a value from a portal that happens to have a non-null holdSnapshot, then that would be the one to use, in preference to just conservatively grabbing the oldest? -Chap ... am I right that the init_toast_snapshot construction is really making only one change to the snapshot data, namely changing the 'satisfies' condition to HeapTupleSatisfiesToast ? The lsn and whenTaken seem to be fetched from the original data and stored right back without change.