It looks to me like we're missing a trick in CancelVirtualTransaction --
there's a loop to compare all VXIDs, and we break as soon as find a
perfect match in (backendid, localTransactionId). However, once we've
found the backendId that matches, it's not possible for there to be
another entry with the same backendId, so we might as well just quit the
loop, even if we don't send a signal.
No, I don't know if this shows in profiles. I just noticed while
reading code.
Attached patch (git diff --ignore-space-change; needs reindent)
illustrates. This was added by commit efc16ea52067 (Dec 2009) and seems
unchanged since then.
--
Álvaro Herrera Developer, https://www.PostgreSQL.org/