Prefix a query with EXPLAIN to retrieve the logical execution plan without running it: EXPLAIN MATCH (u:User {email: $email}) RETURN u — inspect for NodeIndexSeek vs NodeByLabelScan operators
Prefix with PROFILE to execute the query and collect runtime statistics: PROFILE MATCH (u:User)-[:FOLLOWS]->(f) WHERE u.email = $email RETURN f — check db hits and rows per operator
If the plan shows NodeByLabelScan instead of NodeIndexSeek, create a property index: CREATE INDEX user_email_idx FOR (u:User) ON (u.email) and re-run EXPLAIN
For composite lookups create a composite index: CREATE INDEX FOR (u:User) ON (u.email, u.status) — Cypher uses it only when both properties appear in the WHERE clause
Inspect the profile output for high db-hits operators; rewrite the query to push selective filters earlier in the MATCH pattern to reduce the candidate set
Use query hints (USING INDEX u:User(email)) to force a specific index when the planner chooses a suboptimal plan
Known gotchas
PROFILE executes the full query including writes — do not run PROFILE on mutating queries (CREATE, MERGE, DELETE) in production unless on a read replica
Index creation is asynchronous in Neo4j; the index enters POPULATING state and is unavailable for query planning until it reaches ONLINE — check with SHOW INDEXES
The Cypher planner caches execution plans; after creating or dropping an index, plans may need to be invalidated — connecting with a fresh session or waiting for plan cache expiry ensures the new index is used
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp