Back to posts

Cypher Execution Simulator

Step through a graph query from Cypher text to planner choice, index pages, store records, page cache, heap, locks, and disk.

From the Neo4j Database Internals series · July 2026

The simulator

A Cypher query is not one thing. It becomes an AST, a set of planner alternatives, a physical operator pipeline, page cache lookups, store record reads, heap allocations, and sometimes lock waits. This simulator keeps those layers synchronized so the causal chain is visible.

MATCH (e:Entity)-[:HAS_ENUM]->(x:Enum)
WHERE e.externalId = 'ABC-123'
RETURN x.name
Graph Database Pipeline
Stage Idle
DB hits 0
Page hits 0
Page faults 0
Heap 0 KB
Locks 0
Bytes read 0 KB
Relationships 0
Latency 0 ms
Planner Entity

Workload knobs

Change the graph shape and cache pressure, then run the same query again. The model is deliberately approximate, but the direction is the point: supernodes inflate relationship expansion, cold cache turns DB hits into disk reads, and dense relationship groups change the traversal shape.

Current shape: dense node enabled, relationship groups available, moderate page-cache pressure.

Event log and estimates

The canvas is the visual trace. The readout below is the same simulation as a checklist: which stage is active, what it contributes, and what the approximate final cost model predicts for the current graph shape.

Execution log

    Static estimate

    How to read the trace

    The top row is the logical query pipeline: parser, planner, execution, storage, memory, locks, and disk. The panels below it are the machine consequences. When the index stage lights up, GBTree pages and page-cache blocks light up. When relationship expansion lights up, the relationship chain or relationship group directory shows the exact reason DB hits rise.

    Model limits

    This is a pedagogical simulator, not a Neo4j kernel emulator. Real costs depend on runtime statistics, version, store format, indexes, transaction state, record locality, OS cache, concurrency, and the selected runtime. The simulator is useful because it preserves the important causal shape: query form affects operator choice, operator choice affects store access, store access affects page-cache pressure, and page-cache pressure affects latency.

    Takeaways

    Back to posts