"Florian G. Pflug" <fgp@phlo.org> writes:
> Currently, we do not assume that either the childXids array, nor
> the xid cache in the proc array are sorted by ascending xid order.
> I believe that we could simplify the code, further reduce the locking
> requirements, and enabled a transaction to de-overflow it's xid cache
> if we assume that those arrays are in ascending xid order.
"de-overflowing" the cache sounds completely unsafe, as other backends
need that state to determine whether they need to look into pg_subtrans.
I still don't believe you can avoid taking exclusive lock, either; your
argument here did not address latestCompletedXid.
But the main point remains this: there is no evidence whatsoever that
these code paths are sufficiently performance-critical to be worth
speeding up by making the code more fragile.
regards, tom lane