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 |
| Look up relationships by a property value or range | Relationship index (Relationship property indexes) |
| Require a property to hold one type of value | Property type constraint (Constraints) |
| 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, SHOW INDEXES lists every index of every kind and
SHOW CONSTRAINTS every constraint, each with its name. Every index and
constraint has a name, and DROP INDEX name / DROP CONSTRAINT name drop
any kind by name (Index and constraint names).
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
- Index and constraint names
- Property, range and composite indexes
- Relationship property indexes
- Spatial indexes
- Vector search
Related articles
EXPLAIN and PROFILE · Resident and hybrid storage · Schema and maintenance procedures