public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Morris de Oryx <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Remedial C: Does an ltree GiST index *ever* set recheck to true?
Date: Thu, 29 Aug 2024 22:18:11 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAKqnccgejE8E5xheLMd+pDtQ+nXiZHoGhf6yN3FsJ2_rtGzx2g@mail.gmail.com>
References: <CAKqnccgejE8E5xheLMd+pDtQ+nXiZHoGhf6yN3FsJ2_rtGzx2g@mail.gmail.com>

Morris de Oryx <[email protected]> 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 = false;

> I wonder because an ltree GiST index is "lossy" and this behavior is more
> 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 *pages *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






view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Remedial C: Does an ltree GiST index *ever* set recheck to true?
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox