Home Explore Blog CI



postgresql

17th chunk of `doc/src/sgml/spgist.sgml`
30d9a5d64cd3eca2896f583c042a3828e8006bd115f909da0000000100000ab2
 too large to fit
   on an index page.
  </para>

  <para>
   Likewise, it is the operator class's responsibility that inner tuples
   do not grow too large to fit on an index page; this limits the number
   of child nodes that can be used in one inner tuple, as well as the
   maximum size of a prefix value.
  </para>

  <para>
   Another limitation is that when an inner tuple's node points to a set
   of leaf tuples, those tuples must all be in the same index page.
   (This is a design decision to reduce seeking and save space in the
   links that chain such tuples together.)  If the set of leaf tuples
   grows too large for a page, a split is performed and an intermediate
   inner tuple is inserted.  For this to fix the problem, the new inner
   tuple <emphasis>must</emphasis> divide the set of leaf values into more than one
   node group.  If the operator class's <function>picksplit</function> function
   fails to do that, the <acronym>SP-GiST</acronym> core resorts to
   extraordinary measures described in <xref linkend="spgist-all-the-same"/>.
  </para>

  <para>
   When <structfield>longValuesOK</structfield> is true, it is expected
   that successive levels of the <acronym>SP-GiST</acronym> tree will
   absorb more and more information into the prefixes and node labels of
   the inner tuples, making the required leaf datum smaller and smaller,
   so that eventually it will fit on a page.
   To prevent bugs in operator classes from causing infinite insertion
   loops, the <acronym>SP-GiST</acronym> core will raise an error if the
   leaf datum does not become any smaller within ten cycles
   of <function>choose</function> method calls.
  </para>
 </sect3>

 <sect3 id="spgist-null-labels">
  <title>SP-GiST Without Node Labels</title>

  <para>
   Some tree algorithms use a fixed set of nodes for each inner tuple;
   for example, in a quad-tree there are always exactly four nodes
   corresponding to the four quadrants around the inner tuple's centroid
   point.  In such a case the code typically works with the nodes by
   number, and there is no need for explicit node labels.  To suppress
   node labels (and thereby save some space), the <function>picksplit</function>
   function can return NULL for the <structfield>nodeLabels</structfield> array,
   and likewise the <function>choose</function> function can return NULL for
   the <structfield>prefixNodeLabels</structfield> array during
   a <literal>spgSplitTuple</literal> action.
   This will in turn result in <structfield>nodeLabels</structfield> being NULL during
   subsequent calls to <function>choose</function> and <function>inner_consistent</function>.
   In principle, node labels could be used for some inner tuples and omitted
 

Title: SP-GiST Limitations and Optimizations
Summary
SP-GiST has limitations on the size of leaf and inner tuples, and the operator class must ensure that these sizes are managed properly to avoid errors, and it also provides optimizations such as suppressing node labels to save space, which can be useful for certain tree algorithms like quad-trees.