This tutorial should explain how to avoid Cartesian Products

In this tutorial:

There is the query:

MATCH (a:Person), (m:Movie)
WHERE = 'Michael Caine' AND m.title = 'Batman Begins'
CREATE (a)-[:ACTED_IN]->(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.)


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

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.

1 Like