<< >> ~= <@ <<| |>>
</synopsis>
(See <xref linkend="functions-geometry"/> for the meaning of
these operators.)
The SP-GiST operator classes included in the standard distribution are
documented in <xref linkend="spgist-builtin-opclasses-table"/>.
For more information see <xref linkend="spgist"/>.
</para>
<para>
Like GiST, SP-GiST supports <quote>nearest-neighbor</quote> searches.
For SP-GiST operator classes that support distance ordering, the
corresponding operator is listed in the <quote>Ordering Operators</quote>
column in <xref linkend="spgist-builtin-opclasses-table"/>.
</para>
</sect2>
<sect2 id="indexes-types-gin">
<title>GIN</title>
<indexterm>
<primary>index</primary>
<secondary>GIN</secondary>
</indexterm>
<indexterm>
<primary>GIN</primary>
<see>index</see>
</indexterm>
<para>
GIN indexes are <quote>inverted indexes</quote> which are appropriate for
data values that contain multiple component values, such as arrays. An
inverted index contains a separate entry for each component value, and
can efficiently handle queries that test for the presence of specific
component values.
</para>
<para>
Like GiST and SP-GiST, GIN can support
many different user-defined indexing strategies, and the particular
operators with which a GIN index can be used vary depending on the
indexing strategy.
As an example, the standard distribution of
<productname>PostgreSQL</productname> includes a GIN operator class
for arrays, which supports indexed queries using these operators:
<synopsis>
<@ @> = &&
</synopsis>
(See <xref linkend="functions-array"/> for the meaning of
these operators.)
The GIN operator classes included in the standard distribution are
documented in <xref linkend="gin-builtin-opclasses-table"/>.
Many other GIN operator
classes are available in the <literal>contrib</literal> collection or as separate
projects. For more information see <xref linkend="gin"/>.
</para>
</sect2>
<sect2 id="indexes-types-brin">
<title>BRIN</title>
<indexterm>
<primary>index</primary>
<secondary>BRIN</secondary>
</indexterm>
<indexterm>
<primary>BRIN</primary>
<see>index</see>
</indexterm>
<para>
BRIN indexes (a shorthand for Block Range INdexes) store summaries about
the values stored in consecutive physical block ranges of a table.
Thus, they are most effective for columns whose values are well-correlated
with the physical order of the table rows.
Like GiST, SP-GiST and GIN,
BRIN can support many different indexing strategies,
and the particular operators with which a BRIN index can be used
vary depending on the indexing strategy.
For data types that have a linear sort order, the indexed data
corresponds to the minimum and maximum values of the
values in the column for each block range. This supports indexed queries
using these operators:
<synopsis>
< <= = >= >
</synopsis>
The BRIN operator classes included in the standard distribution are
documented in <xref linkend="brin-builtin-opclasses-table"/>.
For more information see <xref linkend="brin"/>.
</para>
</sect2>
</sect1>
<sect1 id="indexes-multicolumn">
<title>Multicolumn Indexes</title>
<indexterm zone="indexes-multicolumn">
<primary>index</primary>
<secondary>multicolumn</secondary>
</indexterm>
<para>
An index can be defined on more than one column of a table. For example, if
you have a table of this form:
<programlisting>
CREATE TABLE test2 (
major int,
minor int,
name varchar
);
</programlisting>
(say, you keep your <filename class="directory">/dev</filename>
directory in a database...) and you frequently issue queries like:
<programlisting>
SELECT name FROM test2 WHERE major = <replaceable>constant</replaceable>