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 1gaPGU-0004qv-79 for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Dec 2018 18:11:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gaPGQ-0005lf-EA for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Dec 2018 18:11:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gaPGQ-0005lY-79 for pgsql-hackers@lists.postgresql.org; Fri, 21 Dec 2018 18:11:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gaPGE-0006ME-7l for pgsql-hackers@lists.postgresql.org; Fri, 21 Dec 2018 18:11:08 +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 wBLIAqVt031683; Fri, 21 Dec 2018 13:10:52 -0500 From: Tom Lane To: Edmund Horner cc: David Rowley , tomas.vondra@2ndquadrant.com, PostgreSQL Developers Subject: Re: Tid scan improvements In-reply-to: References: Comments: In-reply-to Edmund Horner message dated "Tue, 27 Nov 2018 21:16:46 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31681.1545415852.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 21 Dec 2018 13:10:52 -0500 Message-ID: <31682.1545415852@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk BTW, with respect to this bit in 0001: @@ -1795,6 +1847,15 @@ nulltestsel(PlannerInfo *root, NullTestType nulltes= ttype, Node *arg, return (Selectivity) 0; /* keep compiler quiet */ } } + else if (vardata.var && IsA(vardata.var, Var) && + ((Var *) vardata.var)->varattno =3D=3D SelfItemPointerAttrib= uteNumber) + { + /* + * There are no stats for system columns, but we know CTID is nev= er + * NULL. + */ + selec =3D (nulltesttype =3D=3D IS_NULL) ? 0.0 : 1.0; + } else { /* I'm not entirely sure why you're bothering; surely nulltestsel is unrelated to what this patch is about? And would anybody really write "WHERE ctid IS NULL"? However, if we do think it's worth adding code to cover this case, I wouldn't make it specific to CTID. *All* system columns can be assumed not null, see heap_getsysattr(). regards, tom lane