Indexing — researched

An index is a data structure the database keeps sorted so it can find and order documents or rows without scanning the whole collection or table, at the cost of extra writes and storage. Compiled from 9 sources (MongoDB manual and docs, Prisma, Drizzle, Nile/Postgres, Turso/SQLite, Convex, InstantDB, MotherDuck): index types (B-tree, hash, GIN/GiST/SP-GiST/BRIN/bloom, compound, unique, partial, multikey, wildcard, text, geospatial, TTL, hidden, HNSW/IVFFlat), how the query planner chooses and uses an index (explain plans, IXSCAN vs COLLSCAN, covered queries, selectivity, the ESR guideline, hints), how ORMs declare indexes (@@index, index()/uniqueIndex(), .index()/withIndex), and the failure modes (unused or redundant indexes, write overhead, in-memory sorts, full scans).

Definitions

Structure and components

How it works

Parameters and configuration

How-to and procedures

Examples and snippets

Measurements and reference values

Problems, failure modes and limitations

Comparisons and alternatives

Changes and history

Facts and statements

Related concepts