多个neo4j节点连接:“此查询在断开连接的模式之间构建笛卡尔积”(Multiple neo4j node join: “This query builds a cartesian product b

编程入门 行业动态 更新时间:2024-10-28 06:25:06
多个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)

更多推荐

本文发布于:2023-08-07 19:02:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465708.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:笛卡尔   多个   节点   模式   Multiple

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!