Text search and indexingversion 1.3
btree_gin
GIN indexes over plain columns, for mixed indexes.
What it is for
btree_gin teaches GIN indexes to handle ordinary scalar types (integers, text, timestamps). That lets one GIN index cover a plain column together with an array, jsonb or full-text column, such as tenant_id plus tags.
Enable it
create extension if not exists btree_gin with schema extensions;Example
create index events_tenant_tags on events using gin (tenant_id, tags);
select * from events where tenant_id = 7 and tags @> array['billing'];Questions
How do I enable btree_gin?
Run create extension if not exists btree_gin with schema extensions; in the SQL editor, or switch it on from the Extensions page in the console. You do not need superuser access.
Which version of btree_gin is installed?
1.3, on Postgres 17.6, as read from the running engine on 2026-10-08. Check yours with: select extversion from pg_extension where extname = 'btree_gin';
Upstream project: www.postgresql.org/docs/17/btree-gin.html
More text search and indexing extensions
- pg_trgm Fuzzy text search and fast LIKE and ILIKE with trigram indexes.
- unaccent Remove accents from text for search.
- fuzzystrmatch Soundex, Metaphone and Levenshtein distance.
- btree_gist GiST indexes over plain columns, for exclusion constraints.