Re: MergeJoin beats HashJoin in the case of multiple hash clauses

From: Tender Wang <tndrwang(at)gmail(dot)com>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Andrei Lepikhov <lepihov(at)gmail(dot)com>, Tomas Vondra <tomas(at)vondra(dot)me>
Subject: Re: MergeJoin beats HashJoin in the case of multiple hash clauses
Date: 2025-06-30 02:38:46
Message-ID: CAHewXNnZgRPhX06-y+67=h75mfbJjVmtK=28xHwFxfcyK4o0-g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tender Wang <tndrwang(at)gmail(dot)com> 于2025年4月24日周四 22:07写道:

>
>
> Tender Wang <tndrwang(at)gmail(dot)com> 于2025年4月14日周一 14:17写道:
>
>> Hi,
>>
>> While I debug hashjoin codes, in estimate_multivariate_bucketsize(), I
>> find that
>> the list_copy(hashclauses) below is unnecessary if we have a single join
>> clause.
>>
>> List *clauses = list_copy(hashclauses);
>> ...
>>
>> I adjust the place of list_copy() call as the attached patch.
>> This can save some overhead of function calls and memory copies.
>>
>> Any thoughts?
>>
>>
> Hi Alexander,
>
> In the last thread, I found a minor optimization for the code in
> estimate_multivariate_bucketsize().
> Adjust the place of list_copy() at the start of
> estimate_multivariate_bucketsize, and we can avoid unnecessarily creating a
> new list
> and memory copy if we have only a single hash clause.
>
> Do you think it's worth doing this?
>

Hi all,

I have added this patch to commitfest[1]. I'm hoping someone can review it
for me.

[1] https://commitfest.postgresql.org/patch/5704/

--
Thanks,
Tender Wang

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2025-06-30 03:01:42 Re: Check for existing replication slot in pg_createsubscriber
Previous Message Peter Eisentraut 2025-06-29 17:37:05 Re: pg_recvlogical cannot create slots with failover=true