14th September 2023: PostgreSQL 16 Released!
Supported Versions: Current (16) / 15 / 14 / 13 / 12 / 11
Development Versions: devel
Unsupported versions: 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the other supported versions listed above instead.

F.3. btree_gin

btree_gin provides sample GIN operator classes that implement B-Tree equivalent behavior for the data types int2, int4, int8, float4, float8, timestamp with time zone, timestamp without time zone, time with time zone, time without time zone, date, interval, oid, money, "char", varchar, text, bytea, bit, varbit, macaddr, inet, and 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.

F.3.1. Example usage

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

F.3.2. Authors

Teodor Sigaev () and Oleg Bartunov (). See http://www.sai.msu.su/~megera/oddmuse/index.cgi/Gin for additional information.