Stephen Frost <sfrost@snowman.net> writes:
> * Hannu Krosing (hkrosing@gmail.com) wrote:
>> Is there any theoretical obstacle which would make it impossible to
>> teach VACUUM not to hold back the whole vacuum horizon, but just
>> to leave a single transaction alone in case of a long-running
>> REPEATABLE READ transaction ?
> I've looked into this a couple of times and I believe it's possible to
> calculate what records have to remain available for the long-running
> transaction, but it's far from trivial.
I think it'd become a lot easier if we went over to representing snapshots
as LSN positions (and, concomitantly, had an inexpensive way to translate
XIDs to their commit LSNs). That would mean that
(1) a backend's snapshot state could be fully exposed in PGPROC, at least
up to some small number of active snapshots;
(2) it'd be fairly cheap for VACUUM to detect that a dead tuple's XMIN and
XMAX are either both before or both after each live snapshot.
Someone (Heikki, I think) has been working on this but I've not seen
any patch yet.
regards, tom lane