Re: Reduce build times of pg_trgm GIN indexes

From: David Geier <geidav(dot)pg(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reduce build times of pg_trgm GIN indexes
Date: 2026-09-01 11:05:23
Message-ID: ec7e4221-881d-4026-af44-484982b9f101@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

I've rebased the patch set on latest master.

I'm hoping we can make some progress with the patch set, given that it
gives a huge performance improvement, allowing to create GIN indexes on
much bigger tables.

@Heikki and @Matthias: anything specific missing from your point-of-view
that is blocking this patch set from moving forward?

> Attached is the rebased patch set as well as a new patch that optimizes
> ginInsertBAEntries(). Performance improvements are as follows, measured
> with the same benchmark I used in the first mail of this thread.
> Runtimes and deltas are in milliseconds.
>
> Code | movies | delta | lineitem | delta
> -----------------------------------|--------|--------|------------------
> master | 11,160 | - | 248,146 | -
> v7-0001-Make-btint4cmp-branchless | 9,509 | 1,651 | 236,760 | 11,386
> v7-0002-Use-radix-sort | 6,123 | 3,386 | 214,632 | 22,128
> v7-0003-Replace-RB-tree | 4,755 | 1,368 | 144,252 | 70,380

For details of the implementation see my previous mail.

--
David Geier

Attachment Content-Type Size
v8-0003-Replace-RB-tree-with-hash-map-and-sort-in-GIN-ind.patch text/x-patch 14.6 KB
v8-0002-Optimize-generate_trgm-with-radix-sort.patch text/x-patch 2.2 KB
v8-0001-Make-btint4cmp-branchless.patch text/x-patch 1.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2026-09-01 11:50:16 Re: PGQ catalog representation and pg_dump support
Previous Message shveta malik 2026-09-01 10:32:46 Re: Proposal: Conflict log history table for Logical Replication