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 1sjrDS-004qq1-2B for pgsql-general@arkaria.postgresql.org; Fri, 30 Aug 2024 02:18:22 +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 1sjrDO-00ByJq-Gu for pgsql-general@arkaria.postgresql.org; Fri, 30 Aug 2024 02:18:19 +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 1sjrDO-00ByJh-1A for pgsql-general@lists.postgresql.org; Fri, 30 Aug 2024 02:18:18 +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 1sjrDL-0026Ym-LC for pgsql-general@postgresql.org; Fri, 30 Aug 2024 02:18:17 +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 47U2IBNE330808; Thu, 29 Aug 2024 22:18:11 -0400 From: Tom Lane To: Morris de Oryx cc: pgsql-general Subject: Re: Remedial C: Does an ltree GiST index *ever* set recheck to true? In-reply-to: References: Comments: In-reply-to Morris de Oryx message dated "Fri, 30 Aug 2024 11:51:51 +1000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <330806.1724984291.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 29 Aug 2024 22:18:11 -0400 Message-ID: <330807.1724984291@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Morris de Oryx writes: > From what I've seen in the wild, and can sort out from the source, I thi= nk > that ltree does *not* need to load rows from heap. The comment in ltree_consistent is pretty definitive: /* All cases served by this function are exact */ *recheck =3D false; > I wonder because an ltree GiST index is "lossy" and this behavior is mor= e > like a lossless strategy. I think that's either because I've misundersto= od > what "lossy" means in this case, or it's because ltree GiST index *pages= *are > based on a signature (lossy), while ltree GiST index *leaf entries* cont= ain > the full tree/path (lossless.) Yeah, the code is not terribly well commented but this bit in ltree.h appears to be saying that leaf entries contain the original ltree: * type of index key for ltree. Tree are combined B-Tree and R-Tree * Storage: * Leaf pages * (len)(flag)(ltree) * Non-Leaf * (len)(flag)(sign)(left_ltree)(right_ltree) * ALLTRUE: (len)(flag)(left_ltree)(right_ltree) and that seems consistent with the fact that ltree_consistent does different things at leaf and non-leaf levels. regards, tom lane