Re: Reduce build times of pg_trgm GIN indexes

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: David Geier <geidav(dot)pg(at)gmail(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Cc: Japin Li <japinli(at)hotmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reduce build times of pg_trgm GIN indexes
Date: 2026-11-05 11:58:24
Message-ID: df6a9bed-14b1-4540-b88d-0f3f47b3e9c3@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 23/10/2026 10:53, David Geier wrote:
> Attached is v11, rebased on latest master.

Committed
v11-0001-Use-branchless-comparisons-in-btint4cmp-and-btin.patch, since
that one seems uncontroversial. Thanks!

> FWICS, this would only matter if btint4cmp() would get inlined
> somewhere, where the compiler could actually make use of understanding
> that parts of the if-cascade are not needed. Andres' example was
>
>
> return DO_COMPARE(a, b) < 0 ?
> (DO_COMPARE(b, c) < 0 ? b : (DO_COMPARE(a, c) < 0 ? c : a))
> : (DO_COMPARE(b, c) > 0 ? b : (DO_COMPARE(a, c) < 0 ? a : c));
>
>
> In the case of btint4cmp(), it's only ever invoked from the function
> manager, where it cannot be inlined.
>
>
> Or are there ways to invoke btint4cmp() that can be inlined, which I'm
> unaware of?

JIT compilation, maybe? Unless someone shows that there's a measurable
problem though, I wouldn't worry about it.

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2026-11-05 12:17:42 Re: Report buffer access strategies in EXPLAIN
Previous Message Jakub Wartak 2026-11-05 11:45:07 Re: enhancing pg_basebackup speeds up to ~23Gbps (small fixes + io_uring/Direct I/O)