Index

GIN

Generalized Inverted Index: a PostgreSQL index type optimised for columns where each value contains many components, like arrays, JSONB documents, and tsvectors.

A GIN index stores, for each component value, the list of rows that contain it. That makes it ideal for predicates like full-text search, array containment, JSONB key existence, and trigram similarity.

GIN indexes are typically read with a Bitmap Index Scan followed by a Bitmap Heap Scan, so you will see those plan nodes whenever GIN is in use.

The trade-off is write cost: GIN indexes are slower to update than B-trees, and PostgreSQL batches changes through a pending list to amortise that cost. Tune gin_pending_list_limit (or trigger a VACUUM) when high-volume writes back up the pending list.