summaryrefslogtreecommitdiff
path: root/doc/src/sgml/btree-gin.sgml
blob: 8c3cb0269607223a7ae600bf06c86350110f32a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!-- $PostgreSQL: pgsql/doc/src/sgml/btree-gin.sgml,v 1.2 2010/08/17 04:37:20 petere Exp $ -->

<sect1 id="btree-gin">
 <title>btree_gin</title>

 <indexterm zone="btree-gin">
  <primary>btree_gin</primary>
 </indexterm>

 <para>
  <filename>btree_gin</> provides sample GIN operator classes that
  implement B-tree equivalent behavior for the data types
  <type>int2</>, <type>int4</>, <type>int8</>, <type>float4</>,
  <type>float8</>, <type>timestamp with time zone</>,
  <type>timestamp without time zone</>, <type>time with time zone</>,
  <type>time without time zone</>, <type>date</>, <type>interval</>,
  <type>oid</>, <type>money</>, <type>"char"</>,
  <type>varchar</>, <type>text</>, <type>bytea</>, <type>bit</>,
  <type>varbit</>, <type>macaddr</>, <type>inet</>, and <type>cidr</>.
 </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 are useful for GIN testing and as a base for developing other
  GIN operator classes.  Also, for queries that test both a GIN-indexable
  column and a B-tree-indexable column, it might be more efficient to create
  a multicolumn GIN index that uses one of these operator classes than to create
  two separate indexes that would have to be combined via bitmap ANDing.
 </para>

 <sect2>
  <title>Example usage</title>

<programlisting>
CREATE TABLE test (a int4);
-- create index
CREATE INDEX testidx ON test USING gin (a);
-- query
SELECT * FROM test WHERE a &lt; 10;
</programlisting>

 </sect2>

 <sect2>
  <title>Authors</title>

  <para>
   Teodor Sigaev (<email>teodor@stack.net</email>) and
   Oleg Bartunov (<email>oleg@sai.msu.su</email>).  See
   <ulink url="http://www.sai.msu.su/~megera/oddmuse/index.cgi/Gin"></ulink>
   for additional information.
  </para>

 </sect2>

</sect1>