Re: BUG #17975: Nested Loop Index Scan returning wrong result - Mailing list pgsql-bugs

From Peter Geoghegan
Subject Re: BUG #17975: Nested Loop Index Scan returning wrong result
Date
Msg-id CAH2-WzkqMAQYNj_jn=6WDU4x=dX84cj3XpEQnyX=e4oh7=aM-g@mail.gmail.com
Whole thread Raw
In response to Re: BUG #17975: Nested Loop Index Scan returning wrong result  (Andres Freund <andres@anarazel.de>)
Responses Re: BUG #17975: Nested Loop Index Scan returning wrong result  (Andres Freund <andres@anarazel.de>)
List pgsql-bugs
On Wed, Jun 14, 2023 at 1:37 PM Andres Freund <andres@anarazel.de> wrote:
> Something seems to be off with the relevant param - it's NULL. Haven't dug
> deeper.

I see that the bad plan has _bt_first() return false early during a
btgettuple() call for one of the a_pkey index scans. That is,
_bt_first() returns false early in the "Quit now if
_bt_preprocess_keys() discovered that the scan keys can never be
satisfied (eg, x == 1 AND x > 2)" path.

It's possible that this is a red herring -- this is not the only
difference between the "bad" index scan heavy plan and the "good" plan
that uses bitmap scans. But right now my suspicion falls on
_bt_preprocess_keys().

--
Peter Geoghegan



pgsql-bugs by date:

Previous
From: Andres Freund
Date:
Subject: Re: BUG #17975: Nested Loop Index Scan returning wrong result
Next
From: Andres Freund
Date:
Subject: Re: BUG #17975: Nested Loop Index Scan returning wrong result