| 1 |
<!-- doc/src/sgml/btree-gin.sgml --> |
| 2 |
|
| 3 |
<sect1 id="btree-gin" xreflabel="btree_gin"> |
| 4 |
<title>btree_gin — GIN operator classes with B-tree behavior</title> |
| 5 |
|
| 6 |
<indexterm zone="btree-gin"> |
| 7 |
<primary>btree_gin</primary> |
| 8 |
</indexterm> |
| 9 |
|
| 10 |
<para> |
| 11 |
<filename>btree_gin</filename> provides GIN operator classes that |
| 12 |
implement B-tree equivalent behavior for the data types |
| 13 |
<type>int2</type>, <type>int4</type>, <type>int8</type>, <type>float4</type>, |
| 14 |
<type>float8</type>, <type>timestamp with time zone</type>, |
| 15 |
<type>timestamp without time zone</type>, <type>time with time zone</type>, |
| 16 |
<type>time without time zone</type>, <type>date</type>, <type>interval</type>, |
| 17 |
<type>oid</type>, <type>money</type>, <type>"char"</type>, |
| 18 |
<type>varchar</type>, <type>text</type>, <type>bytea</type>, <type>bit</type>, |
| 19 |
<type>varbit</type>, <type>macaddr</type>, <type>macaddr8</type>, <type>inet</type>, |
| 20 |
<type>cidr</type>, <type>uuid</type>, <type>name</type>, <type>bool</type>, |
| 21 |
<type>bpchar</type>, and all <type>enum</type> types. |
| 22 |
</para> |
| 23 |
|
| 24 |
<para> |
| 25 |
In general, these operator classes will not outperform the equivalent |
| 26 |
standard B-tree index methods, and they lack one major feature of the |
| 27 |
standard B-tree code: the ability to enforce uniqueness. However, |
| 28 |
they are useful for GIN testing and as a base for developing other |
| 29 |
GIN operator classes. Also, for queries that test both a GIN-indexable |
| 30 |
column and a B-tree-indexable column, it might be more efficient to create |
| 31 |
a multicolumn GIN index that uses one of these operator classes than to create |
| 32 |
two separate indexes that would have to be combined via bitmap ANDing. |
| 33 |
</para> |
| 34 |
|
| 35 |
<para> |
| 36 |
This module is considered <quote>trusted</quote>, that is, it can be |
| 37 |
installed by non-superusers who have <literal>CREATE</literal> privilege |
| 38 |
on the current database. |
| 39 |
</para> |
| 40 |
|
| 41 |
<sect2 id="btree-gin-example-usage"> |
| 42 |
<title>Example Usage</title> |
| 43 |
|
| 44 |
<programlisting> |
| 45 |
CREATE TABLE test (a int4); |
| 46 |
-- create index |
| 47 |
CREATE INDEX testidx ON test USING GIN (a); |
| 48 |
-- query |
| 49 |
SELECT * FROM test WHERE a < 10; |
| 50 |
</programlisting> |
| 51 |
|
| 52 |
</sect2> |
| 53 |
|
| 54 |
<sect2 id="btree-gin-authors"> |
| 55 |
<title>Authors</title> |
| 56 |
|
| 57 |
<para> |
| 58 |
Teodor Sigaev (<email>[email protected]</email>) and |
| 59 |
Oleg Bartunov (<email>[email protected]</email>). See |
| 60 |
<ulink url="http://www.sai.msu.su/~megera/oddmuse/index.cgi/Gin"></ulink> |
| 61 |
for additional information. |
| 62 |
</para> |
| 63 |
|
| 64 |
</sect2> |
| 65 |
|
| 66 |
</sect1> |