pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Geoghegan <pg@bowt.ie>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid extra lookups with nbtree array inequalities.
Date: Sun, 07 Apr 2024 18:16:22 +0000
Message-ID: <E1rtX42-0010PL-Aw@gemulon.postgresql.org> (raw)

Avoid extra lookups with nbtree array inequalities.

nbtree index scans with SAOP inequalities (but no SAOP equalities)
performed extra ORDER proc lookups for any remaining equality strategy
scan keys.  This could waste cycles, and caused assertion failures.
Keeping around a separate ORDER proc is only necessary for a scan's
non-array/non-SAOP equality scan keys when the scan has at least one
other SAOP equality strategy key (a SAOP inequality shouldn't count).

To fix, replace _bt_preprocess_array_keys_final's assertion with a test
that makes the function return early when the scan has no SAOP equality
scan keys.

Oversight in commit 1b134ca5, which enhanced nbtree ScalarArrayOp
execution.

Reported-By: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/0539d3d3-a402-0a49-ed5e-26429dffc4bd@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/473411fc51157e8e825ee865c2822f976e0da5e3

Modified Files
--------------
src/backend/access/nbtree/nbtutils.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)



Message-ID: <E1rtX42-0010PL-Aw@gemulon.postgresql.org>
Permalink:  ../E1rtX42-0010PL-Aw@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rtX42-0010PL-Aw@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: pg@bowt.ie, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Avoid extra lookups with nbtree array inequalities.
  In-Reply-To: <E1rtX42-0010PL-Aw@gemulon.postgresql.org>

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

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