Re: [PATCH] Add sortsupport for range types and btree_gist

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: [PATCH] Add sortsupport for range types and btree_gist
Дата
Msg-id a27a7d1e-7c24-4355-8e17-9ba5c61837ee@iki.fi
обсуждение исходный текст
Ответ на Re: [PATCH] Add sortsupport for range types and btree_gist  (Bernd Helmle <mailings@oopsware.de>)
Ответы Re: [PATCH] Add sortsupport for range types and btree_gist
Список 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)



В списке pgsql-hackers по дате отправления: