mirror of
https://github.com/postgres/postgres.git
synced 2025-06-26 12:21:12 +03:00
Add an in-core GiST index opclass for inet/cidr types.
This operator class can accelerate subnet/supernet tests as well as btree-equivalent ordered comparisons. It also handles a new network operator inet && inet (overlaps, a/k/a "is supernet or subnet of"), which is expected to be useful in exclusion constraints. Ideally this opclass would be the default for GiST with inet/cidr data, but we can't mark it that way until we figure out how to do a more or less graceful transition from the current situation, in which the really-completely-bogus inet/cidr opclasses in contrib/btree_gist are marked as default. Having the opclass in core and not default is better than not having it at all, though. While at it, add new documentation sections to allow us to officially document GiST/GIN/SP-GiST opclasses, something there was never a clear place to do before. I filled these in with some simple tables listing the existing opclasses and the operators they support, but there's certainly scope to put more information there. Emre Hasegeli, reviewed by Andreas Karlsson, further hacking by me
This commit is contained in:
@ -40,6 +40,184 @@
|
||||
|
||||
</sect1>
|
||||
|
||||
<sect1 id="gist-builtin-opclasses">
|
||||
<title>Built-in Operator Classes</title>
|
||||
|
||||
<para>
|
||||
The core <productname>PostgreSQL</> distribution
|
||||
includes the <acronym>GiST</acronym> operator classes shown in
|
||||
<xref linkend="gist-builtin-opclasses-table">.
|
||||
(Some of the optional modules described in <xref linkend="contrib">
|
||||
provide additional <acronym>GiST</acronym> operator classes.)
|
||||
</para>
|
||||
|
||||
<table id="gist-builtin-opclasses-table">
|
||||
<title>Built-in <acronym>GiST</acronym> Operator Classes</title>
|
||||
<tgroup cols="4">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Name</entry>
|
||||
<entry>Indexed Data Type</entry>
|
||||
<entry>Indexable Operators</entry>
|
||||
<entry>Ordering Operators</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><literal>box_ops</></entry>
|
||||
<entry><type>box</></entry>
|
||||
<entry>
|
||||
<literal>&&</>
|
||||
<literal>&></>
|
||||
<literal>&<</>
|
||||
<literal>&<|</>
|
||||
<literal>>></>
|
||||
<literal><<</>
|
||||
<literal><<|</>
|
||||
<literal><@</>
|
||||
<literal>@></>
|
||||
<literal>@</>
|
||||
<literal>|&></>
|
||||
<literal>|>></>
|
||||
<literal>~</>
|
||||
<literal>~=</>
|
||||
</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>circle_ops</></entry>
|
||||
<entry><type>circle</></entry>
|
||||
<entry>
|
||||
<literal>&&</>
|
||||
<literal>&></>
|
||||
<literal>&<</>
|
||||
<literal>&<|</>
|
||||
<literal>>></>
|
||||
<literal><<</>
|
||||
<literal><<|</>
|
||||
<literal><@</>
|
||||
<literal>@></>
|
||||
<literal>@</>
|
||||
<literal>|&></>
|
||||
<literal>|>></>
|
||||
<literal>~</>
|
||||
<literal>~=</>
|
||||
</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>inet_ops</></entry>
|
||||
<entry><type>inet</>, <type>cidr</></entry>
|
||||
<entry>
|
||||
<literal>&&</>
|
||||
<literal>>></>
|
||||
<literal>>>=</>
|
||||
<literal>></>
|
||||
<literal>>=</>
|
||||
<literal><></>
|
||||
<literal><<</>
|
||||
<literal><<=</>
|
||||
<literal><</>
|
||||
<literal><=</>
|
||||
<literal>=</>
|
||||
</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>point_ops</></entry>
|
||||
<entry><type>point</></entry>
|
||||
<entry>
|
||||
<literal>>></>
|
||||
<literal>>^</>
|
||||
<literal><<</>
|
||||
<literal><@</>
|
||||
<literal><@</>
|
||||
<literal><@</>
|
||||
<literal><^</>
|
||||
<literal>~=</>
|
||||
</entry>
|
||||
<entry>
|
||||
<literal><-></>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>poly_ops</></entry>
|
||||
<entry><type>polygon</></entry>
|
||||
<entry>
|
||||
<literal>&&</>
|
||||
<literal>&></>
|
||||
<literal>&<</>
|
||||
<literal>&<|</>
|
||||
<literal>>></>
|
||||
<literal><<</>
|
||||
<literal><<|</>
|
||||
<literal><@</>
|
||||
<literal>@></>
|
||||
<literal>@</>
|
||||
<literal>|&></>
|
||||
<literal>|>></>
|
||||
<literal>~</>
|
||||
<literal>~=</>
|
||||
</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>range_ops</></entry>
|
||||
<entry>any range type</entry>
|
||||
<entry>
|
||||
<literal>&&</>
|
||||
<literal>&></>
|
||||
<literal>&<</>
|
||||
<literal>>></>
|
||||
<literal><<</>
|
||||
<literal><@</>
|
||||
<literal>-|-</>
|
||||
<literal>=</>
|
||||
<literal>@></>
|
||||
<literal>@></>
|
||||
</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>tsquery_ops</></entry>
|
||||
<entry><type>tsquery</></entry>
|
||||
<entry>
|
||||
<literal><@</>
|
||||
<literal>@></>
|
||||
</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>tsvector_ops</></entry>
|
||||
<entry><type>tsvector</></entry>
|
||||
<entry>
|
||||
<literal>@@</>
|
||||
</entry>
|
||||
<entry>
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
<para>
|
||||
For historical reasons, the <literal>inet_ops</> operator class is
|
||||
not the default class for types <type>inet</> and <type>cidr</>.
|
||||
To use it, mention the class name in <command>CREATE INDEX</>,
|
||||
for example
|
||||
<programlisting>
|
||||
CREATE INDEX ON my_table USING gist (my_inet_column inet_ops);
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
</sect1>
|
||||
|
||||
<sect1 id="gist-extensibility">
|
||||
<title>Extensibility</title>
|
||||
|
||||
|
Reference in New Issue
Block a user