Showing results for 
Search instead for 
Did you mean: 

Difference in specifying the properties inside node and in the where clause

Node Clone


What exactly is the difference between these statements in terms of performance ?

MATCH (m:Movie) WHERE m.released = 2003 RETURN m;

MATCH (m:Movie {released: 2003}) RETURN m;

Thank you.


Graph Voyager

If you run EXPLAIN... on both versions, you would probably see identical execution plans.

Any difference in execution time would probably be down to cache state, which probably shouldn't factor into your query design from what I understand.

Thank you @terryfranklin82. I ran EXPLAIN and they looked identical.

I was under the impression match with the where clause got all of the nodes of type Movie and then filtered them with where clause and I was thinking second match MATCH (m:Movie {released: 2003}) with inline property value went to straight to the node.

Is it safe to understand they are syntactically different but they do the same thing under the hood. ?


Yes I would assume that, early versions of Cypher only had the {prop:value} notation, later the WHERE syntax was added if I remember correctly

That's my understanding. Using parameters does allow for reuse / caching of execution plans, which can speed things up when repeating the same query multiple times -

Nodes 2022
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.