Re: [PATCH] Add sortsupport for range types and btree_gist
Heikki Linnakangas <hlinnaka@iki.fi>
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Bernd Helmle <mailings@oopsware.de>, Andrey Borodin <x4mmm@yandex-team.ru>
Cc: Michael Paquier <michael@paquier.xyz>,
jian he <jian.universality@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-04-02T17:18:33Z
Lists: pgsql-hackers
On 11/03/2025 20:28, Bernd Helmle wrote: > Please find a new rebased version of this patch. Hmm, if we implement sortsupport function for GiST, we can register it for B-tree opfamily as well. The range comparison function has quite high overhead thanks to detoasting, but I'm nevertheless seeing a tiny speedup. I tested that with: setup: create table intranges (r int4range); insert into intranges select int4range(g, g+10) from generate_series(1, 1000000) g; vacuum freeze intranges; test script 'rangesort.sql': set work_mem='100 MB'; explain analyze select r from intranges order by r; test: pgbench -n -f rangesort.sql -P1 postgres -t100 On my laptop, that reports avg latency of 152 ms on master, and 149 ms latency with the patch. Nothing to write home about, but we might as well take it if we have the sortsupport function for gist anyway. So I added it for the btree opfamily too, and moved the function to rangetypes.c since it's not just for gist anymore. I Ccmmitted that part, and will start looking more closely at the remaining btree_gist parts now. -- Heikki Linnakangas Neon (https://neon.tech)
Commits
-
Add support for sorted gist index builds to btree_gist
- e4309f73f698 18.0 landed
-
Add GiST and btree sortsupport routines for range types
- e9e7b66044c9 18.0 landed
-
Change gist stratnum function to use CompareType
- 630f9a43cece 18.0 cited
-
Doc: improve documentation for jsonpath behavior.
- 7014c9a4bba2 17.0 cited
-
Add sortsupport for gist_btree opclasses, for faster index builds.
- 9f984ba6d23d 14.0 cited