Theo Schlossnagle <jesus@omniti.com> writes:
> In production today (8.1.4), I ran into a backend process that
> wouldn't cancel right away -- minutes went by.
> It was in
> [0] TransactionIdIsCurrentTransactionId
> [1] HeapTupleSatisfiesSnapshot
> ...
> But the interesting thing is that there were 4.6 million elements in
> the s->childXids list. Which is why it took so damn long.
Well, I don't think TransactionIdIsCurrentTransactionId() itself is to
blame --- the loop over childXids is about as tight as such a loop could
possibly be (two indirect fetches and a comparison per iteration).
Even with 4.6M child Xids it could hardly take a second on any modern
machine. I'm not inclined to add a CHECK_FOR_INTERRUPTS there. The
problem should instead be blamed on something further down the call
stack ... did you save the full stack by any chance?
regards, tom lane