Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d9fad10

Browse files
Skip searching for subxact locks at commit.
At commit all standby locks are released for the top-level transaction, so searching for locks for each subtransaction is both pointless and costly (N^2) in the presence of many AccessExclusiveLocks.
1 parent 68f7fe1 commit d9fad10

File tree

1 file changed

+4
-2
lines changed
  • src/backend/access/transam

1 file changed

+4
-2
lines changed

src/backend/access/transam/xact.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4609,9 +4609,11 @@ xact_redo_commit_internal(TransactionId xid, XLogRecPtr lsn,
46094609
/*
46104610
* Release locks, if any. We do this for both two phase and normal one
46114611
* phase transactions. In effect we are ignoring the prepare phase and
4612-
* just going straight to lock release.
4612+
* just going straight to lock release. At commit we release all locks
4613+
* via their top-level xid only, so no need to provide subxact list,
4614+
* which will save time when replaying commits.
46134615
*/
4614-
StandbyReleaseLockTree(xid, nsubxacts, sub_xids);
4616+
StandbyReleaseLockTree(xid, 0, NULL);
46154617
}
46164618

46174619
/* Make sure files supposed to be dropped are dropped */

0 commit comments

Comments
 (0)