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 1sjssE-005B1r-Fl for pgsql-general@arkaria.postgresql.org; Fri, 30 Aug 2024 04:04:34 +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 1sjssC-00DNPO-7b for pgsql-general@arkaria.postgresql.org; Fri, 30 Aug 2024 04:04:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sjssB-00DNPF-Rb for pgsql-general@lists.postgresql.org; Fri, 30 Aug 2024 04:04:32 +0000 Received: from mail-oo1-xc2b.google.com ([2607:f8b0:4864:20::c2b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sjss8-002Bki-RW for pgsql-general@postgresql.org; Fri, 30 Aug 2024 04:04:31 +0000 Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-5d5eec95a74so828678eaf.1 for ; Thu, 29 Aug 2024 21:04:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724990668; x=1725595468; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=NMJl1YBwgjkIvy1tvpcwPoQ0JDH8Q9MevLs1oKT4czY=; b=R4ninadIhih/JdVoS4uNxbjZiOXptFbNE+KaZt7JiOTdZJmZTwL3ioBBhpKfwhDxSQ WjtNAhztrEqqL5VOvnq+9f9Im6HFrIUvpzp4j3TLaeTRn8asrofqjVnyJIT9FsuUvnAF 5CzFBgFDTm40bMcSZFWwwB9GtE71XWv7pVf8gwQjemQnJSYA/rpm15k0dqYV/fI8ZXss UMffSNaFffh+l4+F3Mg4qPUh+IEbdg9iBdJdFlFuJ0u+SKfG5perFXuaYWOO1HrcRryY uEJc1obgE6K7vnV1lCYhIZMeVOUl68KF6xM/X/zHSaFh/IAjs7zrekSuO26T0WG15YT+ 1IQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724990668; x=1725595468; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NMJl1YBwgjkIvy1tvpcwPoQ0JDH8Q9MevLs1oKT4czY=; b=vuDKcSfmUX21hUa4jBSFgTWq376/e8/+pbaoaYuTcbdiVFJLNyI66WWPx+SaGO4mk4 B7tU0DpHfjYxEFtowKNzWR3Ko62BgnaRetrupklKo5lbJEWiSUHP9I0zP21HDLROIKjd hII3rGIlZKRACwMAhv17ak1eyzsR2q2pyw1XcGb2tEojtrHhijtNuan5MpK7fwdN4+7O Y0M1XbO/5uDV7SRjspdx8cKtZIILTbS+IJWrRjGTyHeeP2sNFwM2D7DPjDGcKvplJCDL YG8P9Q0dP8XAvOVTCWbTfpY3nGghzZs8z6ah4vM2hMuRCnrBSEy0wDcnGkGHrqXJr4Qb cApQ== X-Gm-Message-State: AOJu0Yx0vqQHApx94pBoYBSNcr/zuStM/fcnHmQWpMCcJJP1yav3+Njh bS2NffBq0EL/hzEAkPVA7Zvc/xfnsqAl+HwSzbeh4Ypgxv2YC8SIC/93pjnnDdbR3mkNFOXZvyU TlCuh02J7BqkeDlp1MbKRmz0kpDiA7Q== X-Google-Smtp-Source: AGHT+IHIixRIybR/Y7OAU6sg8cTwQrfrwoe3XOnh6i9ZTsBRCXYDorSCYIILjYYgWV9t33v4iWbVHWOtTjstEOXoNxU= X-Received: by 2002:a05:6820:2202:b0:5d8:6769:9d85 with SMTP id 006d021491bc7-5dfad01f5bamr1185868eaf.6.1724990667951; Thu, 29 Aug 2024 21:04:27 -0700 (PDT) MIME-Version: 1.0 References: <330807.1724984291@sss.pgh.pa.us> In-Reply-To: <330807.1724984291@sss.pgh.pa.us> From: Morris de Oryx Date: Fri, 30 Aug 2024 14:04:18 +1000 Message-ID: Subject: Re: Remedial C: Does an ltree GiST index *ever* set recheck to true? To: Tom Lane Cc: pgsql-general Content-Type: multipart/alternative; boundary="0000000000000116af0620deb03e" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000000116af0620deb03e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable As always, thanks very much for the confirmation. On Fri, Aug 30, 2024 at 12:18=E2=80=AFPM Tom Lane wrote= : > Morris de Oryx writes: > > From what I've seen in the wild, and can sort out from the source, I > think > > 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 mo= re > > like a lossless strategy. I think that's either because I've > misunderstood > > what "lossy" means in this case, or it's because ltree GiST index *page= s > *are > > based on a signature (lossy), while ltree GiST index *leaf entries* > contain > > 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 > --0000000000000116af0620deb03e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
As always, thanks very much for the confirmation.
On Fri, A= ug 30, 2024 at 12:18=E2=80=AFPM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Morris de= Oryx <morri= sdeoryx@gmail.com> writes:
> From what I've seen in the wild, and can sort out from the source,= I think
> that ltree does *not* need to load rows from heap.

The comment in ltree_consistent is pretty definitive:

=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* All cases served by this function are exact = */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 *recheck =3D false;

> I wonder because an ltree GiST index is "lossy" and this beh= avior is more
> like a lossless strategy. I think that's either because I've m= isunderstood
> what "lossy" means in this case, or it's because ltree G= iST index *pages *are
> based on a signature (lossy), while ltree GiST index *leaf entries* co= ntain
> 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:

=C2=A0* type of index key for ltree. Tree are combined B-Tree and R-Tree =C2=A0* Storage:
=C2=A0*=C2=A0 =C2=A0 Leaf pages
=C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 (len)(flag)(ltree)
=C2=A0*=C2=A0 =C2=A0 Non-Leaf
=C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(len)(= flag)(sign)(left_ltree)(right_ltree)
=C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 ALLTRUE: (len)(flag)(left_ltree)(right_l= tree)

and that seems consistent with the fact that ltree_consistent
does different things at leaf and non-leaf levels.

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 regards, tom lane
--0000000000000116af0620deb03e--