Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hli4E-0006yI-Aq for pgsql-bugs@arkaria.postgresql.org; Thu, 11 Jul 2019 23:01:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hli4C-00083i-3i for pgsql-bugs@arkaria.postgresql.org; Thu, 11 Jul 2019 23:01:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hli4B-00082w-Ol for pgsql-bugs@lists.postgresql.org; Thu, 11 Jul 2019 23:01:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hli44-0005sq-P2 for pgsql-bugs@lists.postgresql.org; Thu, 11 Jul 2019 23:01:30 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x6BN1EP1023598; Thu, 11 Jul 2019 19:01:14 -0400 From: Tom Lane To: Peter Geoghegan cc: Andres Freund , Manuel Rigger , PostgreSQL mailing lists Subject: Re: ERROR: found unexpected null value in index In-reply-to: References: <9288.1562720919@sss.pgh.pa.us> <20825.1562723034@sss.pgh.pa.us> <8251.1562726821@sss.pgh.pa.us> <12489.1562788970@sss.pgh.pa.us> <20190710201547.l6vs6y3cf2tuac73@alap3.anarazel.de> <13550.1562790349@sss.pgh.pa.us> <18788.1562797589@sss.pgh.pa.us> <21234.1562801346@sss.pgh.pa.us> <19241.1562880007@sss.pgh.pa.us> Comments: In-reply-to Peter Geoghegan message dated "Thu, 11 Jul 2019 15:35:13 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23596.1562886074.1@sss.pgh.pa.us> Date: Thu, 11 Jul 2019 19:01:14 -0400 Message-ID: <23597.1562886074@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Peter Geoghegan writes: > On Thu, Jul 11, 2019 at 2:20 PM Tom Lane wrote: >> As far as I can tell, no special finagling is needed: if we just use >> the regular index-only-scan logic then this all works the way we want, >> and it's actually better than before because we get to skip heap visits >> altogether when dealing with unchanging data. Attached is a patch >> against HEAD that seems to do all the right things. > Interesting approach. I certainly prefer it to the alternative > approach of framing the problem as a visibility concern. Yes, I certainly like this better than my previous attempt. I still feel like we're going to want to push (most of?) this logic below the tableam API at some point, because its implementation was and remains tied to heap+btree. But other table AMs are likely to support ordered scan accesses of some sort, and they're going to want to be able to adjust the planner's extremal-value estimates too. It's a job for later though. regards, tom lane