Re: [patch] _bt_binsrch* improvements - equal-prefix-skip binary search - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: [patch] _bt_binsrch* improvements - equal-prefix-skip binary search
Date
Msg-id CAH2-WznPxocJKaz=XMqKqPauawi-vtB62oXT9SkHhDNb7cpV9Q@mail.gmail.com
Whole thread Raw
In response to [patch] _bt_binsrch* improvements - equal-prefix-skip binary search  (Matthias van de Meent <boekewurm+postgres@gmail.com>)
Responses Re: [patch] _bt_binsrch* improvements - equal-prefix-skip binary search
List pgsql-hackers
On Fri, Sep 11, 2020 at 7:57 AM Matthias van de Meent
<boekewurm+postgres@gmail.com> wrote:
> I've not yet been involved in postgresql's development process, so here's a first. Please find attached a patch for
improvingthe BT binary search speeds, with accompanying performance data.
 
>
> v1-0001 adapts _bt_compare and _bt_binsrch* to make use of static properties of L&Y-style nbtree indexes to speed up
findingan initial position in the nbtee.
 

Are you familiar with this thread?

https://www.postgresql.org/message-id/CAH2-Wzn_NAyK4pR0HRWO0StwHmxjP5qyu+X8vppt030XpqrO6w@mail.gmail.com

I wrote a patch that implemented the same idea, which is sometimes
called dynamic prefix truncation. I found some very subtle problems
with it, though. Concurrent page deletions could occur, which could
cause a scan that skips a prefix to miss that the page it landed on
doesn't have the same common prefix anymore.

> there could be a large throughput increase for short strings if the collation lookup from lc_collate_is_c() in
varstr_cmpcould be reused in the subsequent call to pg_newlocale_from_collation()
 

I noticed that myself recently.

--
Peter Geoghegan



pgsql-hackers by date:

Previous
From: Ranier Vilela
Date:
Subject: Re: Simplified version of read_binary_file (src/backend/utils/adt/genfile.c)
Next
From: Tomas Vondra
Date:
Subject: Re: WIP: BRIN multi-range indexes