Skip to content

Commit 4c37c1e

Browse files
committed
Reduce the initial size of local lock hash to 16 entries.
The hash table is seq scanned at transaction end, to release all locks, and making the hash table larger than necessary makes that slower. With very simple queries, that overhead can amount to a few percent of the total CPU time used. At the moment, backend startup needs 6 locks, and a simple query with one table and index needs 3 locks. 16 is enough for even quite complicated transactions, and it will grow automatically if it fills up.
1 parent f536d41 commit 4c37c1e

File tree

1 file changed

+1
-1
lines changed
  • src/backend/storage/lmgr

1 file changed

+1
-1
lines changed

src/backend/storage/lmgr/lock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ InitLocks(void)
346346
hash_flags = (HASH_ELEM | HASH_FUNCTION);
347347

348348
LockMethodLocalHash = hash_create("LOCALLOCK hash",
349-
128,
349+
16,
350350
&info,
351351
hash_flags);
352352
}

0 commit comments

Comments
 (0)