多个neo4j节点连接:“此查询在断开连接的模式之间构建笛卡尔积”(Multiple neo4j node join: “This query builds a cartesian product between disconnected patterns”)
我正在运行此查询:
MATCH (a:TEST:LOC1),(b:TEST_JOIN:LOC1),(c:TEST:LOC1) WHERE a._out = b._in and b._out = c._in and c._text = 'P' CREATE (a)-[r:TEST_JOIN]->(c)它运行速度非常慢,执行计划说:“此查询在断开连接的模式之间构建笛卡尔积”
所有属性都已编入索引,我尝试过:
MATCH (c:TEST:LOC1) where c._text='P' with c MATCH (a:TEST:LOC1),(b:TEST_JOIN:LOC1) WHERE a._out = b._in and b._out = c._in CREATE (a)-[r:TEST_JOIN]->(c)对不起,如果这是基本的。 有谁知道如何优化这个? 提前谢谢了。
I'm running this query:
MATCH (a:TEST:LOC1),(b:TEST_JOIN:LOC1),(c:TEST:LOC1) WHERE a._out = b._in and b._out = c._in and c._text = 'P' CREATE (a)-[r:TEST_JOIN]->(c)It runs very slowly, and the execution plan says: "This query builds a cartesian product between disconnected patterns"
All the properties are indexed and I have tried:
MATCH (c:TEST:LOC1) where c._text='P' with c MATCH (a:TEST:LOC1),(b:TEST_JOIN:LOC1) WHERE a._out = b._in and b._out = c._in CREATE (a)-[r:TEST_JOIN]->(c)Sorry if this is basic. Does anyone know how to optimise this? Many thanks in advance.
最满意答案
我会尝试这个
MATCH (c:TEST:LOC1) where c._text='P' with c MATCH (b:TEST_JOIN:LOC1) where b._out = c._in with b, c Match (a:Test:LOC1) WHERE a._out = b._in with a, c CREATE (a)-[r:TEST_JOIN]->(c)I would try this
MATCH (c:TEST:LOC1) where c._text='P' with c MATCH (b:TEST_JOIN:LOC1) where b._out = c._in with b, c Match (a:Test:LOC1) WHERE a._out = b._in with a, c CREATE (a)-[r:TEST_JOIN]->(c)更多推荐
发布评论