Index

B-tree

Default PostgreSQL index type: a balanced search tree of sorted keys that supports equality and range lookups.

A B-tree index keeps keys sorted in a balanced tree. Lookups, range scans, and ordered traversals are logarithmic in the number of keys, which is why B-trees are the default for almost every column you index.

They support equality (=), inequality (<, <=, >, >=), BETWEEN, IN, and IS NULL/IS NOT NULL predicates, as well as ordering and pattern matches anchored to the start of the value (LIKE 'abc%').

B-trees do not help with full-text search, JSON containment, or trigram similarity — those are jobs for GIN, GIST, or BRIN indexes. Otherwise, when in doubt, reach for a B-tree.

Related terms