In Neo4j (version 3.0), the following queries return the same results:
1. MATCH (a:Label) WHERE a.property = "Something" RETURN a
2. MATCH (a:Label {property: "Something"}) RETURN a
While playing with some large datasets, I noticed (and verified using EXPLAIN
and PROFILE
) that for some instances, queries like the second one performs better and faster. While other instances exist where both versions performed equally, I didn't yet see one where the first version performed better.
The neo4j documentation and tutorials are also divided. There's no explicit comparison between the two. The docs and tuts use both versions, often leaning towards the first (probably because non-exact matches can only be done using the WHERE
clause). But the guidelines also state that the earlier you narrow down the search, the faster the search is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With