A short run-down of the available index types in Postgres.
B-Tree: Default – This is the standard B-Tree index that most database developers are accustomed to using. Good for finding a specific value, or a range of values.
Hash: Index one column only. 32 bit hash value. Used for equality searches.
GIN (Generalized Inverted Indexes): An Inverted Index will index values (like words or numbers) and map them to their location in a document or other collection. GIN indexes are used for indexing values in arrays, or other collections of values, like JSON.
GiST (Generalized Search Tree): Commonly used for searches with spatial and Geometric data, including nearest neighbor searches.
SP-GiST (Space-Partitioned GiST): SP-GiST is suitable for structures where the space can be recursively split into non-intersecting areas. This class comprises quadtrees, k-dimensional trees (k-D trees), and radix trees. Useful for similar scenarios as GiST , but when the values don’t overlap, so that the data can be partitioned.
BRIN (Block Range INdexes): For values stored in order – Index stores information on the ranges of data (like the min and max), so is useful for large datasets to narrow down the location of the needed range.
Links:
Postgres 14 Internals: Book with a chapter on the index types