Re: MergeJoin beats HashJoin in the case of multiple hash clauses - Mailing list pgsql-hackers

From Tender Wang
Subject Re: MergeJoin beats HashJoin in the case of multiple hash clauses
Date
Msg-id CAHewXNkYn=0BLatE6z1yv9h8g1N8mQy1unzZ7x8sg0kzf4PXMQ@mail.gmail.com
Whole thread Raw
In response to Re: MergeJoin beats HashJoin in the case of multiple hash clauses  (Tender Wang <tndrwang@gmail.com>)
List pgsql-hackers


Tender Wang <tndrwang@gmail.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?
--
Thanks,
Tender Wang

pgsql-hackers by date:

Previous
From: Christoph Berg
Date:
Subject: Re: vacuumdb --missing-stats-only and pg_upgrade from PG13
Next
From: Noah Misch
Date:
Subject: Re: pg_upgrade-breaking release