| From: | Alain LESAGE <alain(dot)lesage(at)dalibo(dot)com> |
|---|---|
| To: | Tatsuya Kawata <kawatatatsuya0913(at)gmail(dot)com> |
| Cc: | pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Speed up hash join builds by linking tuples into buckets in groups |
| Date: | 2026-12-02 21:25:59 |
| Message-ID: | 01be1d8d-0d15-4774-9a78-f83c10dc36e4@dalibo.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Tatsuya,
I ran your bench.sh on an Intel i5-1135G7, an Apple M1 Pro and a Ryzen
7 5700G (Zen3, in a VM), master and patched on ede11da551b. Change from
master to patched, medians of 40 to 60 runs, yours in the last column:
i5 M1 Pro 5700G yours
3M rows (bucket array 32MB) -38.5% -53.2% -33.9% -36.0%
3M wide rows -27.1% -48.6% -24.8% -23.9%
Parallel Hash, 3M rows (2 workers) -28.5% -33.6% -24.2% -30.3%
300K rows (4MB) -5.4% -12.2% +2.5% -6.5%
underestimated, table rebuilt +0.6% -0.6% -6.2% -6.4%
60K rows (at the threshold) +6.0% +2.2% +3.1% +0.7%
duplicate keys +6.1% +1.9% +7.1% +0.7%
So the large builds gain everywhere, and even more on the M1. The
rebuilt table only gains on Zen3, here as on yours.
The duplicate keys case does not look like noise on x86. Same 3M rows,
with a varying number of distinct keys:
i5 M1 Pro 5700G
3M rows, 10 distinct keys +6.1% +1.9% +7.1%
3M rows, 1k distinct keys +5.5% +1.2% +6.2%
3M rows, 10k distinct keys +4.4% -0.1% +3.5%
3M rows, 100k distinct keys -26.7% -39.8% -18.6%
3M rows, 3M distinct keys -38.7% -52.7% -35.0%
The threshold counts buckets, but the gain depends on how many of them
the tuples touch.
The regression tests pass with assertions, but none of them builds a
hash table with 65536 buckets or more, so they never reach the new
code. With the threshold lowered to 1, they reach it and still pass.
Regards,
Alain
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Shlok Kyal | 2026-12-02 21:28:30 | Re: Show the conflict log table in \dRs+ output |
| Previous Message | brianmacy | 2026-12-02 21:23:18 | [PATCH v1] Open only the target segment to reach existing blocks |