Indexes and constraints
On this page
Which index for which job?
| You want to… | Use |
|---|---|
Fast exact lookup … {prop: v} / WHERE n.prop = v | Property index (Property, range and composite indexes) |
| Ordered range or prefix predicates | Range/composite indexes |
| Membership or position inside list properties | Element indexes |
| Require a value, tuple, shared or per-element identity | Constraint families |
| Ordered range or prefix predicates | Range/composite indexes |
| Membership or position inside list properties | Element indexes |
| Require a value, tuple, shared or per-element identity | Constraint families |
| Guarantee a property is unique per label | Uniqueness constraint (Constraints and shared uniqueness) |
| Relevance-ranked text search over a string property | Full-text index + SEARCH (Full-text search) |
| Nearest-neighbour over embedding vectors | Vector index (Vector search) |
| Distance / radius queries over points | Point index (Spatial indexes) |
| Find shapes intersecting a query geometry | Spatial shape index and explicit db.index.spatial.intersects (Spatial indexes) |
Persistence of indexes
For a complete inventory, use SHOW INDEXES for hash, range, composite and
element declarations, plus SHOW FULLTEXT INDEXES, SHOW VECTOR INDEXES and
SHOW POINT INDEXES and SHOW SPATIAL INDEXES. SHOW CONSTRAINTS lists every constraint kind.
All indexes are declaration-only on disk: the declaration is persisted (in the WAL/snapshot), and the index contents are rebuilt by re-reading the stored values on replay/restore. This keeps the on-disk format small and means an index can never hold stale entries after a restart. See Operations.
Articles
- Constraints and shared uniqueness
- Element indexes and staged values
- Full-text search
- Property, range and composite indexes
- Spatial indexes
- Vector search
Related articles
EXPLAIN and PROFILE · Resident and hybrid storage · Schema and maintenance procedures