【发布时间】:2014-10-21 07:16:23
【问题描述】:
我在从具有 2 个可选路径的图表中选择数据时遇到问题。假设节点 A、B、C,其中 A 与 B 和 C 具有可选关系。
如果我查询
match (a:A) where a.xx = XX optional match (a:A)-->(b:B) return ...
或
match (a:A) where a.xx = XX optional match (a:A)-->(c:C) return ...
一切都按预期进行。
如果我结合2:
match (a:A) where a.xx = XX
optional match (a:A)-->(b:B)
optional match (a:A)-->(c:C)
return ...
然后我只得到(经过长时间的查询)一个未知错误。
return 从 a,b,c 中选择属性,并使用限制来限制返回的数据量。难道不能有多个可选匹配吗?
更新: 当我将查询更改为
match (a1:A) where a.xx = XX
optional match (a2:A)-->(b:B) where a2.uid = a1.uid
optional match (a3:A)-->(c:C) where a3.uid = a1.uid
return ...
如果 uid 是唯一的索引 id,则查询返回所需的结果。 但是它运行得非常慢(如果 uid 是索引则约 60 秒,如果 uid 具有唯一约束则约 40 秒) 数据集并不是我所说的巨大:a 6500 、 b 86 和 c 90000 个条目。
【问题讨论】:
-
显示错误时是否没有堆栈跟踪?如果您有堆栈跟踪,请编辑您的问题并添加它。
-
没有错误出现(当通过neo4j控制台启动时,我也在控制台中检查了messages.log)。还使用最新版本 (2.1.5) 进行了测试,结果相同。查询运行了一段时间,吃掉了 1 个核心,然后在客户端中只出现“错误”而停止..
标签: neo4j pattern-matching cypher