Conceptual
Login

Index Kinds Beyond the B-Tree, and When a B-Tree Cannot Help

A B-tree serves equality, ranges, sorting and prefix matches on ordinary scalar values, and there are questions it structurally cannot answer: does this JSON document contain this key, does this text match these words, do these two shapes overlap. PostgreSQL offers other index types for those cases, GIN for multi-valued things like text and JSON, GiST for geometry and ranges, BRIN for huge tables whose values track physical order, and hash for exact equality only. The point is not to learn them here but to recognise the boundary, so that when your predicate is outside what ordering can serve you stop trying to fix it with another B-tree.

Questions this Concept answers

  • Why can a B-tree not answer the question does this JSON document contain this key?