[英]Cypher: Use WHERE clause or MATCH property definition for exact match?
In Neo4j (version 3.0), the following queries return the same results: 在Neo4j(3.0版)中,以下查询返回相同的结果:
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. 在处理一些大型数据集时,我注意到(并使用
EXPLAIN
和PROFILE
进行了验证),在某些情况下,第二个查询之类的查询性能更好,更快。 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. neo4j文档和教程也有所不同。 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). docs和tut使用这两个版本,通常倾向于第一个版本(可能是因为只能使用
WHERE
子句来完成不完全匹配)。 But the guidelines also state that the earlier you narrow down the search, the faster the search is. 但是指南还指出,缩小搜索范围的越早,搜索速度就越快。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.