cancel
Showing results for 
Search instead for 
Did you mean: 
clem
Graph Steward

In this tutorial:

There is the query:

MATCH (a:Person), (m:Movie)
WHERE a.name = 'Michael Caine' AND m.title = 'Batman Begins'
CREATE (a)-[:ACTED_IN]->(m)
RETURN a, m

with an explanation that this query will create a cartesian product but it does NOT explain how to avoid that!

Avoiding a cartesian product is explained here:

(I would have made a Pull Request on it, but I don't know where it lives in github.)

2 Comments
dana_canzano
Neo4j
Neo4j

Yes that cypher statement does create a Cartesian join but it's a 1x1 Cartesian since each match returns only 1 row given the data model

clem
Graph Steward

That's not the point of my suggestion.

I got the warning but I didn't have any idea of how to fix it until today.

It's not immediately obvious how to not do a Cartesian Product.