From: | cca5507 <cca5507(at)qq(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Small optimization with expanding dynamic hash table |
Date: | 2025-07-07 06:00:09 |
Message-ID: | tencent_571C8FF040D62E25F4A0F0AAD63EA545A605@qq.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi, hackers
If I understand correctly, we only need to check the specific bit to determine whether a hash element needs relocation:
diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c
index 1ad155d446e..32fbae71995 100644
--- a/src/backend/utils/hash/dynahash.c
+++ b/src/backend/utils/hash/dynahash.c
@@ -1626,7 +1626,7 @@ expand_table(HTAB *hashp)
currElement = nextElement)
{
nextElement = currElement->link;
- if ((long) calc_bucket(hctl, currElement->hashvalue) == old_bucket)
+ if (!(currElement->hashvalue & (hctl->low_mask + 1)))
{
*oldlink = currElement;
oldlink = &currElement->link;
--
Regards,
ChangAo Chen
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Small-optimization-with-expanding-dynamic-hash-ta.patch | application/octet-stream | 839 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | John Naylor | 2025-07-07 06:58:18 | Re: Avoid circular header file dependency |
Previous Message | Michael Paquier | 2025-07-07 05:56:29 | Re: Adding wait events statistics |