Choosing an Index
Indexes trade write cost and storage for faster reads. The right index starts with the query shape, not the table shape.
Common Defaults
- B-Tree works well for equality and range queries.
- GIN is useful for arrays, JSONB, and full-text search.
- GiST can support geometric and similarity queries.
Measure with EXPLAIN ANALYZE before and after adding an index.