Index

GiST

Generalized Search Tree: an extensible PostgreSQL index framework for geometric, range, and full-text data.

A GiST index is a generic balanced-tree skeleton that operator classes plug into. Where a B-tree only knows total ordering, a GiST node can describe any "containment" relationship — bounding boxes, ranges, trigrams, or tsvector lexemes.

GiST powers PostGIS spatial indexes, range-type indexes, the pg_trgm extension for fuzzy text matching, and the older tsvector full-text index option. It supports nearest-neighbour queries via the <-> distance operator, which B-trees cannot do.

Trade-offs vs GIN: GiST builds and updates faster but searches are slower for "many matches" workloads. For tsvector full-text search GIN is the usual default, with GiST chosen only when write throughput matters more than query speed.

Related terms