Re: Hash index build performance tweak from sorting

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Cc: Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Hash index build performance tweak from sorting
Date: 2022-11-24 02:47:19
Message-ID: CAApHDvpyoGwu3-TuzK-T4SVMxsZSD4t+mun63jnj5vQksNq06g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 24 Nov 2022 at 08:08, Tomas Vondra
<tomas(dot)vondra(at)enterprisedb(dot)com> wrote:
> >> So to me it seems v2 performs demonstrably better, v3 is consistently
> >> slower - not only compared to v2, but often also to master.
> >
> > Could this just be down to code alignment changes? There does not
> > really seem to be any fundamental differences which would explain
> > this.
> >
>
> Could be, but then how do we know the speedup with v2 is not due to code
> alignment too?

It's a good question. Back when I was working on 913ec71d6, I had
similar problems that I saw wildly different performance gains
depending on which commit I patched with. I sorted that out by just
benchmarking on a bunch of different commits both patched and
unpatched.

I've attached a crude bash script which looks at every commit since
1st November 2022 that's changed anything in src/backend/* and runs a
benchmark with and without the v4 patch. That was 76 commits when I
tested. In each instance, with the test I ran, I saw between a 5 and
15% performance improvement with the v4 patch. No commit showed any
performance regression. That makes me fairly happy that there's a
genuine win with this patch.

I've attached the script and the benchmark files along with the
results and a chart.

David

Attachment Content-Type Size
bench_commits.sh.txt text/plain 1.4 KB
bench.sql application/octet-stream 49 bytes
bench_clean.sql application/octet-stream 26 bytes
prewarm.sql application/octet-stream 25 bytes
output.txt text/plain 24.5 KB
setup.sql application/octet-stream 132 bytes
unpatched_vs_v4_patch.png image/png 418.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2022-11-24 02:57:57 Re: Collation version tracking for macOS
Previous Message Jeff Davis 2022-11-24 02:07:43 Re: Collation version tracking for macOS