Hi,
The v3 patch attached. (Add some comment in commit msg)
--
Regards,
ChangAo Chen
v3-0001-Small-optimization-with-expanding-dynamic-hash-ta.patch
Description: Binary data
Hi
> The v2 patch maybe more clear:
> We can calc bucket just by hashvalue & high_mask when expanding table
because the if condition in calc_bucket() must be false.
I think you may add a comment to this path so that code reviewers can
clearly see your optimization.
Thanks
On Thu, Jul 10, 2025 at
Hi,
The v2 patch maybe more clear:
We can calc bucket just by hashvalue & high_mask when expanding table
because the if condition in calc_bucket() must be false.
--
Regards,
ChangAo Chen
v2-0001-Small-optimization-with-expanding-dynamic-hash-ta.patch
Description: Binary data
> One thing to note is that in this scenario, there is no safeguard if
the hashvalue is 0x111 and new_bucket is 0x110.
But the hash table is already corrupted if the hashvalue 0x111 in
old_bucket 0x010, all hashvalue in old_bucket should have: hashvalue &
low_mask == old_bucket's no.
--
Regar
Hi,
Yes, for example:
>>
>> low_mask: 0x011, high_mask: 0x111, old_bucket: 0x010, new_bucket: 0x110
>>
>> The old_bucket's hash value like 0x***010 or 0x***110, the later is in
>> the old_bucket is because we didn't have new_bucket before, so only hash
>> value like 0x***110 needs relocation: hash
Hi,
Yes, for example:
>
> low_mask: 0x011, high_mask: 0x111, old_bucket: 0x010, new_bucket: 0x110
>
> The old_bucket's hash value like 0x***010 or 0x***110, the later is in the
> old_bucket is because we didn't have new_bucket before, so only hash value
> like 0x***110 needs relocation: hashvalue
> Will this still work if new_bucket is not equal to hctl->low_mask
+ 1?Yes, for example:
low_mask: 0x011, high_mask: 0x111, old_bucket: 0x010, new_bucket: 0x110
The old_bucket's hash value like 0x***010 or 0x***110, the later is in the
old_bucket is because we didn't have new_bucket before,
Hi,
> 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