Where to put the filter
Three places to filter
- Inline in the pattern:
(:Person {name:'Alice'})— fastest, lets the planner hit an index immediately. - WHERE clause:
WHERE p.age > 30— for expressions, ranges, list / string predicates. - Pattern existence:
WHERE EXISTS { (p)-[:OWNS]->(:Car) }— 'has at least one outgoing OWNS to a Car'.
Prefer inline for equality + indexed properties; reach for WHERE for ranges or boolean logic.