public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Geoghegan <[email protected]>
To: Andres Freund <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Matthias van de Meent <[email protected]>
Cc: Konstantin Knizhnik <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Incorrect result of bitmap heap scan.
Date: Mon, 2 Dec 2024 16:16:19 -0500
Message-ID: <CAH2-Wzmit-OxVZ4aaqAuOpX2NqSX4iayV_37bpdKRZybwOHPcg@mail.gmail.com> (raw)
In-Reply-To: <6nev7zfx57h5pkqpgdp4q37xjcj2dxqilsgbb5ac5lhub4whsb@ap7ptu6yqyj6>
References: <[email protected]>
	<CAEze2Wg1Q4gWzm9RZ0yXydm23Mj3iScu8LA__Zz3JJEgpnoGPQ@mail.gmail.com>
	<CAH2-Wzn9ZGt8mYMrbDMSRSps3t-ro4JNFXbAvk_jwUoKi=gANQ@mail.gmail.com>
	<[email protected]>
	<fw54ktry2576xqvztx642ee6352rwc57y5hs6arcfjeowq6yon@3njdaxumsidi>
	<[email protected]>
	<CAH2-WzmNuB-xmQ29=GfL0g9nXrdYoPZo3Zeqm0UTncCWJQmMvw@mail.gmail.com>
	<[email protected]>
	<CAH2-WzmiOd9-tvqRV-8oyXNkvaiAK_=LYT-gX8GkinZqeXEneQ@mail.gmail.com>
	<6nev7zfx57h5pkqpgdp4q37xjcj2dxqilsgbb5ac5lhub4whsb@ap7ptu6yqyj6>

On Mon, Dec 2, 2024 at 3:55 PM Andres Freund <[email protected]> wrote:
> I suspect one contributor to this avoiding attention till now was that the
> optimization is fairly narrow:
>
>                         /*
>                          * We can potentially skip fetching heap pages if we do not need
>                          * any columns of the table, either for checking non-indexable
>                          * quals or for returning data.  This test is a bit simplistic, as
>                          * it checks the stronger condition that there's no qual or return
>                          * tlist at all. But in most cases it's probably not worth working
>                          * harder than that.
>                          */
>                         need_tuples = (node->ss.ps.plan->qual != NIL ||
>                                                    node->ss.ps.plan->targetlist != NIL);
>
> Even an entry in the targetlist that that does not depend on the current row
> disables the optimization.

Good point. I agree that that factor is likely to have masked the
problem over the past 6 years.

-- 
Peter Geoghegan






view thread (2+ messages)

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Incorrect result of bitmap heap scan.
  In-Reply-To: <CAH2-Wzmit-OxVZ4aaqAuOpX2NqSX4iayV_37bpdKRZybwOHPcg@mail.gmail.com>

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

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