Hi, On 2020-04-01 16:59:51 -0700, Andres Freund wrote: > The primary issue here is that there is no TestForOldSnapshot() in > heap_hot_search_buffer(). Therefore index fetches will never even try to > detect that tuples it needs actually have already been pruned away.
FWIW, with autovacuum=off the query does not get killed until a manual vacuum, nor if fewer rows are deleted and the table has previously been vacuumed. The vacuum in the second session isn't required. There just needs to be something consuming an xid, so that oldSnapshotControl->latest_xmin is increased. A single SELECT txid_current(); or such in a separate session is sufficient. Greetings, Andres Freund