Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-20-2020 05:52 PM
Greetings,
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.
04-20-2020 11:57 PM
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.
04-21-2020 05:51 AM
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. ?
Thanks
04-21-2020 06:57 AM
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
04-22-2020 04:23 PM
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 - https://neo4j.com/blog/cypher-write-fast-furious/#parameters
All the sessions of the conference are now available online