Home Explore Blog CI



postgresql

4th chunk of `doc/src/sgml/gist.sgml`
d0ef9ec71aa41c79facd6fbdbfaf637f5200b08cdfb21b640000000100000fa3
 valign="middle" morerows="17"><literal>range_ops</literal></entry>
      <entry><literal>= (anyrange, anyrange)</literal></entry>
      <entry valign="middle" morerows="17"></entry>
     </row>
     <row><entry><literal>&amp;&amp; (anyrange, anyrange)</literal></entry></row>
     <row><entry><literal>&amp;&amp; (anyrange, anymultirange)</literal></entry></row>
     <row><entry><literal>@&gt; (anyrange, anyelement)</literal></entry></row>
     <row><entry><literal>@&gt; (anyrange, anyrange)</literal></entry></row>
     <row><entry><literal>@&gt; (anyrange, anymultirange)</literal></entry></row>
     <row><entry><literal>&lt;@ (anyrange, anyrange)</literal></entry></row>
     <row><entry><literal>&lt;@ (anyrange, anymultirange)</literal></entry></row>
     <row><entry><literal>&lt;&lt; (anyrange, anyrange)</literal></entry></row>
     <row><entry><literal>&lt;&lt; (anyrange, anymultirange)</literal></entry></row>
     <row><entry><literal>&gt;&gt; (anyrange, anyrange)</literal></entry></row>
     <row><entry><literal>&gt;&gt; (anyrange, anymultirange)</literal></entry></row>
     <row><entry><literal>&amp;&lt; (anyrange, anyrange)</literal></entry></row>
     <row><entry><literal>&amp;&lt; (anyrange, anymultirange)</literal></entry></row>
     <row><entry><literal>&amp;&gt; (anyrange, anyrange)</literal></entry></row>
     <row><entry><literal>&amp;&gt; (anyrange, anymultirange)</literal></entry></row>
     <row><entry><literal>-|- (anyrange, anyrange)</literal></entry></row>
     <row><entry><literal>-|- (anyrange, anymultirange)</literal></entry></row>

     <row>
      <entry valign="middle" morerows="1"><literal>tsquery_ops</literal></entry>
      <entry><literal>&lt;@ (tsquery, tsquery)</literal></entry>
      <entry valign="middle" morerows="1"></entry>
     </row>
     <row><entry><literal>@&gt; (tsquery, tsquery)</literal></entry></row>
     <row>
      <entry valign="middle"><literal>tsvector_ops</literal></entry>
      <entry><literal>@@ (tsvector, tsquery)</literal></entry>
      <entry></entry>
     </row>
    </tbody>
   </tgroup>
  </table>

 <para>
  For historical reasons, the <literal>inet_ops</literal> operator class is
  not the default class for types <type>inet</type> and <type>cidr</type>.
  To use it, mention the class name in <command>CREATE INDEX</command>,
  for example
<programlisting>
CREATE INDEX ON my_table USING GIST (my_inet_column inet_ops);
</programlisting>
 </para>

</sect2>

<sect2 id="gist-extensibility">
 <title>Extensibility</title>

 <para>
   Traditionally, implementing a new index access method meant a lot of
   difficult work.  It was necessary to understand the inner workings of the
   database, such as the lock manager and Write-Ahead Log.  The
   <acronym>GiST</acronym> interface has a high level of abstraction,
   requiring the access method implementer only to implement the semantics of
   the data type being accessed.  The <acronym>GiST</acronym> layer itself
   takes care of concurrency, logging and searching the tree structure.
 </para>

 <para>
   This extensibility should not be confused with the extensibility of the
   other standard search trees in terms of the data they can handle.  For
   example, <productname>PostgreSQL</productname> supports extensible B-trees
   and hash indexes. That means that you can use
   <productname>PostgreSQL</productname> to build a B-tree or hash over any
   data type you want. But B-trees only support range predicates
   (<literal>&lt;</literal>, <literal>=</literal>, <literal>&gt;</literal>),
   and hash indexes only support equality queries.
 </para>

 <para>
   So if you index, say, an image collection with a
   <productname>PostgreSQL</productname> B-tree, you can only issue queries
   such as <quote>is imagex equal to imagey</quote>, <quote>is imagex less
   than imagey</quote> and <quote>is imagex greater than imagey</quote>.
   Depending on how you define <quote>equals</quote>, <quote>less than</quote>
   and <quote>greater than</quote>

Title: GiST Indexes and Operator Classes
Summary
The passage describes the GiST (Generalized Search Tree) index access method in PostgreSQL, including various operator classes such as range_ops, tsquery_ops, and tsvector_ops, and explains how GiST provides extensibility for implementing new index access methods, allowing developers to create custom indexes for specific data types and queries.