Home Explore Blog CI



postgresql

6th chunk of `doc/src/sgml/xindex.sgml`
6a94a1e5abf623d5a4f6adc18e29b52bc18e6896af8683850000000100000fb1
 <entry>6</entry>
      </row>
     </tbody>
    </tgroup>
   </table>

  <para>
   Hash indexes require one support function, and allow two additional ones to
   be supplied at the operator class author's option, as shown in <xref
   linkend="xindex-hash-support-table"/>.
  </para>

   <table tocentry="1" id="xindex-hash-support-table">
    <title>Hash Support Functions</title>
    <tgroup cols="2">
     <colspec colname="col1" colwidth="3*"/>
     <colspec colname="col2" colwidth="1*"/>
     <thead>
      <row>
       <entry>Function</entry>
       <entry>Support Number</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry>Compute the 32-bit hash value for a key</entry>
       <entry>1</entry>
      </row>
      <row>
       <entry>
         Compute the 64-bit hash value for a key given a 64-bit salt; if
         the salt is 0, the low 32 bits of the result must match the value
         that would have been computed by function 1
         (optional)
       </entry>
       <entry>2</entry>
      </row>
      <row>
       <entry>
        Define options that are specific to this operator class
        (optional)
       </entry>
       <entry>3</entry>
      </row>
     </tbody>
    </tgroup>
   </table>

  <para>
   GiST indexes have twelve support functions, seven of which are optional,
   as shown in <xref linkend="xindex-gist-support-table"/>.
   (For more information see <xref linkend="gist"/>.)
  </para>

   <table tocentry="1" id="xindex-gist-support-table">
    <title>GiST Support Functions</title>
    <tgroup cols="3">
     <colspec colname="col1" colwidth="2*"/>
     <colspec colname="col2" colwidth="3*"/>
     <colspec colname="col3" colwidth="1*"/>
     <thead>
      <row>
       <entry>Function</entry>
       <entry>Description</entry>
       <entry>Support Number</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry><function>consistent</function></entry>
       <entry>determine whether key satisfies the
        query qualifier</entry>
       <entry>1</entry>
      </row>
      <row>
       <entry><function>union</function></entry>
       <entry>compute union of a set of keys</entry>
       <entry>2</entry>
      </row>
      <row>
       <entry><function>compress</function></entry>
       <entry>compute a compressed representation of a key or value
        to be indexed (optional)</entry>
       <entry>3</entry>
      </row>
      <row>
       <entry><function>decompress</function></entry>
       <entry>compute a decompressed representation of a
        compressed key (optional)</entry>
       <entry>4</entry>
      </row>
      <row>
       <entry><function>penalty</function></entry>
       <entry>compute penalty for inserting new key into subtree
       with given subtree's key</entry>
       <entry>5</entry>
      </row>
      <row>
       <entry><function>picksplit</function></entry>
       <entry>determine which entries of a page are to be moved
       to the new page and compute the union keys for resulting pages</entry>
       <entry>6</entry>
      </row>
      <row>
       <entry><function>same</function></entry>
       <entry>compare two keys and return true if they are equal</entry>
       <entry>7</entry>
      </row>
      <row>
       <entry><function>distance</function></entry>
       <entry>determine distance from key to query value (optional)</entry>
       <entry>8</entry>
      </row>
      <row>
       <entry><function>fetch</function></entry>
       <entry>compute original representation of a compressed key for
       index-only scans (optional)</entry>
       <entry>9</entry>
      </row>
      <row>
       <entry><function>options</function></entry>
       <entry>define options that are specific to this operator class
        (optional)</entry>
       <entry>10</entry>
      </row>
      <row>
       <entry><function>sortsupport</function></entry>
       <entry>provide a sort comparator to be used in fast index builds
        (optional)</entry>
       <entry>11</entry>

Title: Support Functions for Hash and GiST Indexes
Summary
This section details the support functions required for Hash and GiST indexes in PostgreSQL. Hash indexes require one mandatory function to compute a 32-bit hash value for a key, and allow two optional functions: a 64-bit hash value computation with salt, and a function to define operator class-specific options. GiST indexes are more complex, requiring twelve support functions, of which seven are optional. These functions include operations like consistency checking, union computation, compression/decompression, penalty calculation for insertions, split determination, equality comparison, distance calculation, and more. Each function is assigned a specific support number and serves a unique purpose in the index's functionality. The text provides detailed tables for both Hash and GiST support functions, explaining their roles and whether they are mandatory or optional.