简体   繁体   English

LIMIT有多少影响neo4j“ allShortestPaths”密码查询性能

[英]How much LIMIT affect neo4j “allShortestPaths” cypher query performance

I have learned that how much higher will your LIMIT be, how much higher DbHits will be done during the Execution Plan,and neo4j is using A* algorithm for "allShortestPaths" query. 我了解到,您的LIMIT将提高多少,在执行计划期间将完成多少DbHits,并且neo4j使用A *算法进行“ allShortestPaths”查询。

My first question is dose LIMIT also affect neo4j "allShortestPaths" query.If it does affect, how much it affects, why it affect? 我的第一个问题是LIMIT剂量也会影响neo4j的“ allShortestPaths”查询。如果确实影响,那么会影响多少,为什么会影响?

I have do some test.but i haven't found the obvious evidence that the LIMIT affect performance as we expect 我进行了一些测试。但是我没有发现明显的证据表明LIMIT会像预期的那样影响性能

[EDITED] [编辑]

My test query: 我的测试查询:

MATCH
  (node1:E { eid:"c953fc2d-55fc-4239-910e-ae6e41b3648d" }),
  (node2:E { eid:"e8cdf5e0-97ad-4e1e-a8e4-29358f8a9866" }),
  p = allShortestPaths((node1)-[*]-(node2))
RETURN p
LIMIT 25;

The LIMIT in you test query does not limit the amount of work done by allShortestPaths ; 测试查询中的LIMIT不会限制allShortestPaths完成的allShortestPaths instead, it just limits the number of results you get back. 相反,它只会限制您获得的结果数量。

The only way to affect the amount of work done by allShortestPaths is by putting an upper bound on the length of the paths searched. 影响allShortestPaths完成的allShortestPaths的唯一方法是对搜索路径的长度设置上限。 For example, this query will only search paths with up to 5 relationships: 例如,此查询将仅搜索具有5个关系的路径:

MATCH
  (node1:E { eid:"c953fc2d-55fc-4239-910e-ae6e41b3648d" }),
  (node2:E { eid:"e8cdf5e0-97ad-4e1e-a8e4-29358f8a9866" }),
  p = allShortestPaths((node1)-[*..5]-(node2))
RETURN p
LIMIT 25;

By the way, to speed up the matching of the end nodes you should create an index on :E(eid) . 顺便说一句,为了加快末端节点的匹配速度,您应该在:E(eid)创建一个索引

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM