agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: David Geier <geidav.pg@gmail.com>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Reduce build times of pg_trgm GIN indexes
Date: Thu, 9 Apr 2026 11:28:24 +0000
Message-ID: <adeNWH5pDawDvvR2@ip-10-97-1-34.eu-west-3.compute.internal> (raw)
In-Reply-To: <6439c655-e281-409d-b884-6586750d5820@iki.fi>
References: <5d366878-2007-4d31-861e-19294b7a583b@gmail.com>
	<9ac3931a-180e-4283-a7a8-05eb66099206@iki.fi>
	<e5dd01c6-c469-405d-aea2-feca0b2dc34d@gmail.com>
	<2e11134f-02c3-43da-8c39-fb520a1a251d@iki.fi>
	<66620ec7-0f81-4813-9cf1-b901a56efcc3@gmail.com>
	<CAEze2WiUL9idZBbuUN+MuWqr6DcPr_-C91E9MTx=H62Xx5fHaQ@mail.gmail.com>
	<ef8782c9-68b7-4915-9f79-497765a8e205@gmail.com>
	<a90ebbbd-0d77-49c7-b222-3dbffa4e3b14@gmail.com>
	<2a76b5ef-4b12-4023-93a1-eed6e64968f3@gmail.com>
	<6439c655-e281-409d-b884-6586750d5820@iki.fi>

Hi,

On Tue, Apr 07, 2026 at 02:27:40PM +0300, Heikki Linnakangas wrote:
> On 03/03/2026 19:31, David Geier wrote:
> > > Attached are the patches rebased on latest master.
> > > 
> > > I've removed the ASCII fast-path patch 0006 as it turned out to be more
> > > complicated to make work than expected.
> > > 
> > > I kept the radix sort patch because it gives a decent speedup but I
> > > would like to focus for now on getting patches 0001 - 0004 merged.
> > > They're all simple and, the way I see it, uncontroversial.
> > > 
> > > I remeasured the savings of 0001 - 0004, which comes on top of the
> > > already committed patch that inlined the comparison function, which gave
> > > another ~5%:
> > > 
> > > Data set            | Patched (ms) | Master (ms)  | Speedup
> > > --------------------|--------------|--------------|----------
> > > movies(plot)        |   8,058      |  10,311      | 1.27x
> > > lineitem(l_comment) | 223,233      | 256,986      | 1.19x
> > > 
> > > I've also registered the change at the commit fest, see
> > > https://commitfest.postgresql.org/patch/6418/.
> > 
> > Attached is v5 that removes an incorrect assertion from the radix sort code.
> > 
> > v5-0001-Optimize-sort-and-deduplication-in-ginExtractEntr.patch
> > v5-0002-Optimize-generate_trgm-with-sort_template.h.patch
> > v5-0003-Make-btint4cmp-branchless.patch
> > v5-0004-Faster-qunique-comparator-in-generate_trgm.patch
> > v5-0005-Optimize-generate_trgm-with-radix-sort.patch
> 
> Pushed 0001 as commit 6f5ad00ab7.

This commit makes use of StaticAssertStmt() that has been deprecated in 
d50c86e74375. The attached, fixes it.

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachments:

  [text/x-diff] v1-0001-gin-change-remaining-StaticAssertStmt-to-StaticAs.patch (1.4K, ../adeNWH5pDawDvvR2@ip-10-97-1-34.eu-west-3.compute.internal/2-v1-0001-gin-change-remaining-StaticAssertStmt-to-StaticAs.patch)
  download | inline diff:
From a2289b5c7db807592e470b525ac71cfea2a7cba3 Mon Sep 17 00:00:00 2001
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Date: Thu, 9 Apr 2026 11:10:33 +0000
Subject: [PATCH v1] gin: change remaining StaticAssertStmt() to
 StaticAssertDecl()

d50c86e74375 added a comment mentioning that StaticAssertStmt is deprecated
but 6f5ad00ab763 made use of it.

Fixing by replacing the StaticAssertStmt() by StaticAssertDecl() at file scope.

Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
---
 src/backend/access/gin/ginutil.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
 100.0% src/backend/access/gin/

diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c
index d3351fbe8a3..45d1a8fac9f 100644
--- a/src/backend/access/gin/ginutil.c
+++ b/src/backend/access/gin/ginutil.c
@@ -30,6 +30,8 @@
 #include "utils/typcache.h"
 #include "lib/qunique.h"
 
+/* GIN_CAT_NORM_KEY must be equal to 0 */
+StaticAssertDecl(GIN_CAT_NORM_KEY == 0, "Assuming GIN_CAT_NORM_KEY=0");
 
 /*
  * GIN handler function: return IndexAmRoutine with access method parameters
@@ -534,7 +536,6 @@ ginExtractEntries(GinState *ginstate, OffsetNumber attnum,
 	/*
 	 * Create GinNullCategory representation.
 	 */
-	StaticAssertStmt(GIN_CAT_NORM_KEY == 0, "Assuming GIN_CAT_NORM_KEY=0");
 	categories = palloc0_array(GinNullCategory, nentries + (hasNull ? 1 : 0));
 
 	/* Put back a NULL entry, if there were any */
-- 
2.34.1

view thread (51+ messages)  latest in thread

Message-ID: <adeNWH5pDawDvvR2@ip-10-97-1-34.eu-west-3.compute.internal>
Permalink:  ../adeNWH5pDawDvvR2@ip-10-97-1-34.eu-west-3.compute.internal/
Also on:    postgresql.org/message-id/adeNWH5pDawDvvR2@ip-10-97-1-34.eu-west-3.compute.internal

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: bertranddrouvot.pg@gmail.com, hlinnaka@iki.fi, geidav.pg@gmail.com, boekewurm+postgres@gmail.com
  Subject: Re: Reduce build times of pg_trgm GIN indexes
  In-Reply-To: <adeNWH5pDawDvvR2@ip-10-97-1-34.eu-west-3.compute.internal>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox