0

When I try to execute the comnand, but appear some waining:

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: (r))

MATCH (s1:Station { id: toInteger(csvLine.fromId)}),(r:Route { id: toInteger(csvLine.route_informationId)}),(s2:Station { id: toInteger(csvLine.toId)})

initial input comnand:

LOAD CSV WITH HEADERS FROM "https://lovecandyhsu.neocities.org/relations.csv" AS csvLine
MATCH (s1:Station { id: toInteger(csvLine.fromId)}),(r:Route { id: toInteger(csvLine.route_informationId)}),(s2:Station { id: toInteger(csvLine.toId)})
OPTIONAL MATCH (s1)<-[:FROM]->(r)
OPTIONAL MATCH (r)<-[:TO]->(s2)
RETURN csvLine

How to solve this problems? thank.

  • 1
    Does this answer your question? [Why does neo4j warn: "This query builds a cartesian product between disconnected patterns"?](https://stackoverflow.com/questions/33352673/why-does-neo4j-warn-this-query-builds-a-cartesian-product-between-disconnected) – Simon Thordal Mar 29 '22 at 11:51
  • What do you want to achieve? I see that you are loading the csv file then doing match then returning the contents for the csv file? This does not makes sense. – jose_bacoy Mar 29 '22 at 12:01

0 Answers0