Indexing strategy
Index the paths you filter and join on; skip the rest. Each index is a persistent B-tree that speeds up reads but adds work to every write and takes disk space.
- Index high-selectivity predicates (
pnr,email) — they turn scans into lookups. - Use a unique index where a field must be one-per-document; it also enforces the constraint.
- Index nested paths and array elements you query (
passenger.lastName,flights[0].from).
This guide is being expanded with worked examples and cost trade-offs.
Last updated on