Home Explore Blog CI



postgresql

7th chunk of `doc/src/sgml/xindex.sgml`
c765a0e7db891b4cdadee9de86b2841553bca2cc67de82f50000000100000fa1
 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>
      </row>
      <row>
       <entry><function>translate_cmptype</function></entry>
       <entry>translate compare types to strategy numbers
        used by the operator class (optional)</entry>
       <entry>12</entry>
      </row>
     </tbody>
    </tgroup>
   </table>

  <para>
   SP-GiST indexes have six support functions, one of which is optional, as
   shown in <xref linkend="xindex-spgist-support-table"/>.
   (For more information see <xref linkend="spgist"/>.)
  </para>

   <table tocentry="1" id="xindex-spgist-support-table">
    <title>SP-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>config</function></entry>
       <entry>provide basic information about the operator class</entry>
       <entry>1</entry>
      </row>
      <row>
       <entry><function>choose</function></entry>
       <entry>determine how to insert a new value into an inner tuple</entry>
       <entry>2</entry>
      </row>
      <row>
       <entry><function>picksplit</function></entry>
       <entry>determine how to partition a set of values</entry>
       <entry>3</entry>
      </row>
      <row>
       <entry><function>inner_consistent</function></entry>
       <entry>determine which sub-partitions need to be searched for a
        query</entry>
       <entry>4</entry>
      </row>
      <row>
       <entry><function>leaf_consistent</function></entry>
       <entry>determine whether key satisfies the
        query qualifier</entry>
       <entry>5</entry>
      </row>
      <row>
       <entry><function>options</function></entry>
       <entry>define options that are specific to this operator class
        (optional)</entry>
       <entry>6</entry>
      </row>
     </tbody>
    </tgroup>
   </table>

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

   <table tocentry="1" id="xindex-gin-support-table">
    <title>GIN 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>compare</function></entry>
       <entry>
        compare two keys and return an integer less than zero, zero,
        or greater than zero, indicating whether the first key is less than,
        equal to, or greater than the second
       </entry>
       <entry>1</entry>

Title: Support Functions for GiST, SP-GiST, and GIN Indexes
Summary
This section details support functions for three types of PostgreSQL indexes: GiST, SP-GiST, and GIN. GiST indexes require twelve support functions, with five mandatory and seven optional. These functions include operations like consistency checking, union computation, and distance calculation. SP-GiST indexes need six support functions, with five mandatory and one optional. These include config, choose, picksplit, inner_consistent, and leaf_consistent functions. GIN indexes use seven support functions, three mandatory and four optional. The mandatory functions for GIN include compare, extractValue, and extractQuery. Each function is assigned a specific support number and serves a unique purpose in the respective index's functionality. The text provides detailed tables for all three index types, explaining the role of each function and whether it's mandatory or optional.