btree gin


Teodor Sigaev and Oleg Bartunov

<!-- $PostgreSQL: pgsql/doc/src/sgml/btree-gin.sgml,v 1.1 2009/03/25 23:20:01 tgl Exp $ -->

<sect1 id="btree-gin">

 <indexterm zone="btree-gin">

  <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</>.

  In general, these operator classes will not outperform the equivalent
  standard btree index methods, and they lack one major feature of the
  standard btree 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 btree-indexable column, it might be more efficient to create
  a multi-column GIN index that uses one of these opclasses than to create
  two separate indexes that would have to be combined via bitmap ANDing.

  <title>Example usage</title>

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



   Teodor Sigaev (<email></email>) and
   Oleg Bartunov (<email></email>).  See
   <ulink url=""></ulink>
   for additional information.