Skip to main content
Version: 1.0.16

btree_gin

btree_gin provides GIN operator class examples 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, macaddr8, inet, cidr, uuid, name, bool, bpchar, and all enum types.

Typically, these operator classes are no better than the equivalent standard B-tree index method, 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 basis for developing other GIN operator classes. Additionally, for queries that test a GIN-indexable column and a B-tree-indexable column, creating a multicolumn GIN index using one of these operator classes is more efficient than creating two separate indexes that must be combined via bitmap AND.

This module is considered "trusted", meaning it can be installed by non-superusers who have CREATE privilege on the current database.

1. Usage Example

test=## create extension btree_gin;
CREATE EXTENSION

test=## CREATE TABLE test (a int4);
CREATE TABLE

test=## CREATE INDEX testidx ON test USING GIN (a);
CREATE INDEX

test=## SELECT * FROM test WHERE a < 10;

a

---

(0 rows)