Re: Bug in nbtree optimization to skip > operator comparisons (or < comparisons in backwards scans)

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Subject: Re: Bug in nbtree optimization to skip > operator comparisons (or < comparisons in backwards scans)
Date: 2023-12-06 04:20:01
Message-ID: CAH2-Wznz=z3r3w15QTGB7rRj8ihec_jWWhroxTYGKU9-RKaFHw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 5, 2023 at 8:06 PM Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
> Thank you for raising this issue. Preprocessing of btree scan keys is
> normally removing the redundant scan keys. However, redundant scan
> keys aren't removed when they have arguments of different types.
> Please give me a bit of time to figure out how to workaround this.

Couldn't you condition the use of the optimization on
_bt_preprocess_keys being able to use cross-type operators when it
checked for redundant or contradictory scan keys? The vast majority of
index scans will be able to do that.

As I said already, what you're doing here isn't all that different to
the way that we rely on required equality strategy scan keys being
used to build our initial insertion scan key, that determines where
the scan is initially positioned to within _bt_first. Inequalities
aren't all that different to equalities.

--
Peter Geoghegan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-12-06 04:32:28 Re: [PoC] pg_upgrade: allow to upgrade publisher node
Previous Message vignesh C 2023-12-06 04:10:43 Re: [PoC] pg_upgrade: allow to upgrade publisher node