Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rt7Vy-00CLoa-5q for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Apr 2024 14:59:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rt7Vx-00DB6L-6q for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Apr 2024 14:59:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rt7Vw-00DB5c-Th for pgsql-hackers@lists.postgresql.org; Sat, 06 Apr 2024 14:59:28 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rt7Vu-001CDW-AH for pgsql-hackers@postgresql.org; Sat, 06 Apr 2024 14:59:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 436Ex7771939306; Sat, 6 Apr 2024 10:59:07 -0400 From: Tom Lane To: Melanie Plageman cc: Tomas Vondra , Thomas Munro , Heikki Linnakangas , Andres Freund , Pg Hackers , Nazir Bilal Yavuz Subject: Re: BitmapHeapScan streaming read user and prelim refactoring In-reply-to: <20240406134011.hjo3e2336sgcghfp@liskov> References: <20240327193750.3mlcmzqondpj27xe@liskov> <7e98781c-34e0-4c02-8e5b-0500aa074271@enterprisedb.com> <8330278b-9615-4030-8626-51ce714a7f54@enterprisedb.com> <20240331154551.lty4mundyoyhtixw@liskov> <20240403225759.sq5hmxdmbalroosy@liskov> <95d9471f-ead4-4215-b739-f6d6f4c19497@enterprisedb.com> <20240405080634.d7c23f46xjhhxf5q@liskov> <20240405235330.v4didvweb6isodtk@liskov> <20240406134011.hjo3e2336sgcghfp@liskov> Comments: In-reply-to Melanie Plageman message dated "Sat, 06 Apr 2024 09:40:11 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1939304.1712415547.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 06 Apr 2024 10:59:07 -0400 Message-ID: <1939305.1712415547@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Melanie Plageman writes: > On Sat, Apr 06, 2024 at 02:51:45AM +0200, Tomas Vondra wrote: >> * The one question I'm somewhat unsure about is why Tom chose to use th= e >> "wrong" recheck flag in the 2017 commit, when the correct recheck flag >> is readily available. Surely that had a reason, right? But I can't thin= k >> of one ... > See above. Hi, I hadn't been paying attention to this thread, but Melanie pinged me off-list about this question. I think it's just a flat-out oversight in 7c70996eb. Looking at the mailing list thread (particularly [1][2]), it seems that Alexander hadn't really addressed the question of when to prefetch at all, but just skipped prefetch if the current page was skippable: + /* + * If we did not need to fetch the current page, + * we probably will not need to fetch the next. + */ + return; It looks like I noticed that we could check the appropriate VM bits, but failed to notice that we could easily check the appropriate recheck flag as well. Feel free to change it. regards, tom lane [1] https://www.postgresql.org/message-id/a6434d5c-ed8d-b09c-a7c3-b2d1677e= 35b3%40postgrespro.ru [2] https://www.postgresql.org/message-id/5974.1509573988%40sss.pgh.pa.us