Ich versuche immer noch zu verstehen, warum ich eine kartesische Produktwarnung für ein bestimmtes Format für eine Abfrage in Neo4j und nicht für eine andere erhalten. Dies ist, wie ich meine Datenbank einrichten:Warum erhalte ich eine Warnung "kartesisches Produkt"?
CREATE (q:Form {version: "1.0"})
CREATE (q:Question {text: "Sector de la empresa", active: true})
Ich habe dann versucht, die folgende Abfrage:
MATCH
(f:Form {version: "1.0"}),
(q:Question {text: "Sector de la empresa"})
CREATE (f)-[:asks]->(q)
RETURN f, q
Allerdings bekomme ich die folgende Warnung:
This query builds a cartesian product between disconnected patterns.
If a part of a query contains multiple disconnected patterns,
this will build a cartesian product between all those parts.
This may produce a large amount of data and slow down query processing.
While occasionally intended, it may often be possible to reformulate the
query that avoids the use of this cross product, perhaps by adding a
relationship between the different parts or by using OPTIONAL MATCH
(identifier is: (q))
Wenn ich die folgenden Abfrage, gibt es mir diese Warnung nicht:
MATCH (f:Form {version: "1.0"})
WITH f
(q:Question {text: "Sector de la empresa"})
CREATE (f)-[:asks]->(q)
RETURN f, q
noch 0
wenn ich diese Abfrage:
MATCH (f:Form {version: "1.0"})
MATCH (q:Question {text: "Sector de la empresa"})
CREATE (f)-[:asks]->(q)
RETURN f, q
ich diesen folgenden Artikel als Ressource verwendet wird, aber es hat immer noch nicht ganz meine Frage beantworten: Why does neo4j warn: "This query builds a cartesian product between disconnected patterns"?
Warum ich ein kartesisches Produkt für einige bekommen Formate einer Abfrage und nicht andere? Außerdem verstehe ich nicht ganz, was eine kartesische Produktwarnung ist.