Neo4j: error adding links between existing nodes

When writing a query to add relationships to existing nodes, he warns me with this message:

“This query creates a Cartesian product between unrelated patterns. If a part of the query contains several unrelated patterns, this will create a Cartesian product between all of these parts. This can lead to a lot of data and slow down the processing of queries. Sometimes, you can occasionally reformulate a query that avoids use of this cross product, possibly by adding a relationship between the different parts or by using an ADDITIONAL MATCH (identifier: (e)) "

If I run a query, it does not create a relationship . Request:

match   
    (a{name:"Angela"}),
    (b{name:"Carlo"}),
    (c{name:"Andrea"}),
    (d{name:"Patrizia"}),
    (e{name:"Paolo"}),
    (f{name:"Roberta"}),
    (g{name:"Marco"}),
    (h{name:"Susanna"}),
    (i{name:"Laura"}),
    (l{name:"Giuseppe"})


create  
    (a)-[:mother]->(b),
    (a)-[:grandmother]->(c), (e)-[:grandfather]->(c), (i)-[:grandfather]->(c), (l)-[:grandmother]->(c),
    (b)-[:father]->(c),
    (e)-[:father]->(b),
    (l)-[:father]->(d),
    (i)-[:mother]->(d),
    (d)-[:mother]->(c),
    (c)-[:boyfriend]->(f),
    (g)-[:brother]->(f),
    (g)-[:brother]->(h),
    (f)-[:sister]->(g), (f)-[:sister]->(h)

- ?

PS: , ( match), .

+4
2

?

  • , , , , certains ( name, node, , .

  • , , , . , 500 000 name : "Angela" 500 000 name : "Carlo", Angela node, , (500 000 * 500 000 , , ). Cypher .

  • Cypher , , , .

?

  • , , .

  • , Neo4j - SQL .

, , PROFILE , :

Cypher Execution Plan

+4

name? , , . MERGE.

Supamiu , ( Person) :Person(name).

0

Source: https://habr.com/ru/post/1616505/


All Articles