Indexes and constraints

Wiki

On this page

Which index for which job?

You want to…Use
Fast exact lookup … {prop: v} / WHERE n.prop = vProperty index (Property, range and composite indexes)
Ordered range or prefix predicatesRange/composite indexes
Membership or position inside list propertiesElement indexes
Require a value, tuple, shared or per-element identityConstraint families
Look up relationships by a property value or rangeRelationship index (Relationship property indexes)
Require a property to hold one type of valueProperty type constraint (Constraints)
Guarantee a property is unique per labelUniqueness constraint (Constraints and shared uniqueness)
Relevance-ranked text search over a string propertyFull-text index + SEARCH (Full-text search)
Nearest-neighbour over embedding vectorsVector index (Vector search)
Distance / radius queries over pointsPoint index (Spatial indexes)
Find shapes intersecting a query geometrySpatial 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

EXPLAIN and PROFILE · Resident and hybrid storage · Schema and maintenance procedures

Planning a deployment? Review compatibility and licence setup for your instance.