Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip searching for subxact locks at commit.
authorSimon Riggs <simon@2ndQuadrant.com>
Tue, 13 Nov 2012 19:00:19 +0000 (16:00 -0300)
committerSimon Riggs <simon@2ndQuadrant.com>
Tue, 13 Nov 2012 19:00:19 +0000 (16:00 -0300)
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.

src/backend/access/transam/xact.c

index c24df3f38c2bbf2e0becfe0394cb92fd6b6566d1..10386dadce5cbd6a7f8ce2e71e64a0406acf9f14 100644 (file)
@@ -4609,9 +4609,11 @@ xact_redo_commit_internal(TransactionId xid, XLogRecPtr lsn,
        /*
         * Release locks, if any. We do this for both two phase and normal one
         * phase transactions. In effect we are ignoring the prepare phase and
-        * just going straight to lock release.
+        * just going straight to lock release. At commit we release all locks
+        * via their top-level xid only, so no need to provide subxact list,
+        * which will save time when replaying commits.
         */
-       StandbyReleaseLockTree(xid, nsubxacts, sub_xids);
+       StandbyReleaseLockTree(xid, 0, NULL);
    }
 
    /* Make sure files supposed to be dropped are dropped */