Home Explore Blog CI



postgresql

1st chunk of `doc/src/sgml/btree-gist.sgml`
064d1f97a6105ba186b77d0363c178732a6ae16a689eb049000000010000098d
<!-- doc/src/sgml/btree-gist.sgml -->

<sect1 id="btree-gist" xreflabel="btree_gist">
 <title>btree_gist &mdash; GiST operator classes with B-tree behavior</title>

 <indexterm zone="btree-gist">
  <primary>btree_gist</primary>
 </indexterm>

 <para>
  <filename>btree_gist</filename> provides GiST index operator classes that
  implement B-tree equivalent behavior for the data types
  <type>int2</type>, <type>int4</type>, <type>int8</type>, <type>float4</type>,
  <type>float8</type>, <type>numeric</type>, <type>timestamp with time zone</type>,
  <type>timestamp without time zone</type>, <type>time with time zone</type>,
  <type>time without time zone</type>, <type>date</type>, <type>interval</type>,
  <type>oid</type>, <type>money</type>, <type>char</type>,
  <type>varchar</type>, <type>text</type>, <type>bytea</type>, <type>bit</type>,
  <type>varbit</type>, <type>macaddr</type>, <type>macaddr8</type>, <type>inet</type>,
  <type>cidr</type>, <type>uuid</type>, <type>bool</type> and all <type>enum</type> types.
 </para>

 <para>
  In general, these operator classes will not outperform the equivalent
  standard B-tree index methods, and they lack one major feature of the
  standard B-tree code: the ability to enforce uniqueness.  However,
  they provide some other features that are not available with a B-tree
  index, as described below.  Also, these operator classes are useful
  when a multicolumn GiST index is needed, wherein some of the columns
  are of data types that are only indexable with GiST but other columns
  are just simple data types.  Lastly, these operator classes are useful for
  GiST testing and as a base for developing other GiST operator classes.
 </para>

 <para>
  In addition to the typical B-tree search operators, <filename>btree_gist</filename>
  also provides index support for <literal>&lt;&gt;</literal> (<quote>not
  equals</quote>). This may be useful in combination with an
  <link linkend="sql-createtable-exclude">exclusion constraint</link>,
  as described below.
 </para>

 <para>
  Also, for data types for which there is a natural distance metric,
  <filename>btree_gist</filename> defines a distance operator <literal>&lt;-&gt;</literal>,
  and provides GiST index support for nearest-neighbor searches using
  this operator.  Distance operators are provided for
  <type>int2</type>, <type>int4</type>, <type>int8</type>, <type>float4</type>,
  <type>float8</type>, <type>timestamp

Title: Btree_Gist: GiST Operator Classes with B-tree Behavior
Summary
The btree_gist module provides GiST index operator classes that mimic B-tree behavior for various data types, offering features like nearest-neighbor searches and support for exclusion constraints, despite lacking uniqueness enforcement and potentially being outperformed by standard B-tree indexes.