Re: Improving btree performance through specializing by key shape, take 2

From: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
To: David Christensen <david(at)pgguru(dot)net>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Improving btree performance through specializing by key shape, take 2
Date: 2023-01-20 19:37:58
Message-ID: CAEze2WixWviBYTWXiFLbD3AuLT4oqGk_MykS_ssB=TudeZ=ajQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 12 Jan 2023 at 16:11, David Christensen <david(at)pgguru(dot)net> wrote:
>
> Hi Matthias,
>
> I'm going to look at this patch series if you're still interested. What was the status of your final performance testing for the 0008 patch alone vs the specialization series? Last I saw on the thread you were going to see if the specialization was required or not.

Thank you for your interest, and sorry for the delayed response. I've
been working on rebasing and polishing the patches, and hit some
issues benchmarking the set. Attached in Perf_results.xlsx are the
results of my benchmarks, and a new rebased patchset.

TLDR for benchmarks: There may be a small regression 0.5-1% in the
patchset for reindex and insert-based workloads in certain corner
cases, but I can't rule out that it's just a quirk of my testing
setup. Master was taken at eb5ad4ff, and all patches are based on that
as well.

0001 (former 0008) sees 2% performance loss on average on
non-optimized index insertions - this performance loss is fixed with
the rest of the patchset.

The patchset was reordered again: 0001 contains the dynamic prefix
truncation changes; 0002 and 0003 refactor and update btree code to
specialize on key shape, and 0004 and 0006 define the specializations.

0005 is a separated addition to attcacheoff infrastructure that is
useful on it's own; it flags an attribute with 'this attribute cannot
have a cached offset, look at this other attribute instead'.

A significant change from previous versions is that the specialized
function identifiers are published as macros, so `_bt_compare` is
published as a macro that (based on context) calls the specialized
version. This reduced a lot of cognitive overhead and churn in the
code.

Kind regards,

Matthias van de Meent

Attachment Content-Type Size
Perf_results.xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet 37.9 KB
v8-0001-Implement-dynamic-prefix-compression-in-nbtree.patch application/octet-stream 23.2 KB
v8-0005-Add-an-attcacheoff-populating-function.patch application/octet-stream 4.7 KB
v8-0004-Optimize-nbts_attiter-for-nkeyatts-1-btrees.patch application/octet-stream 6.2 KB
v8-0003-Use-specialized-attribute-iterators-in-the-specia.patch application/octet-stream 13.3 KB
v8-0002-Specialize-nbtree-functions-on-btree-key-shape.patch application/octet-stream 247.2 KB
v8-0006-btree-specialization-for-variable-length-multi-at.patch application/octet-stream 11.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-01-20 19:39:56 Re: Question regarding "Make archiver process an auxiliary process. commit"
Previous Message Karl O. Pinc 2023-01-20 19:33:46 Re: Doc: Rework contrib appendix -- informative titles, tweaked sentences