When I try to execute the following query (to create a relationship between teachers and students), I see an eager pop up in the profile:
USING PERIODIC COMMIT 10000
LOAD CSV WITH HEADERS FROM "file:/AFile" as line
WITH line
MATCH (teacher:Teacher {ValueOne: toInt(line.ValueOne)})
MATCH (bully:Bully { Value2:toInt(line.ValueTwo)})
MATCH (bully)-[:LOVES]->(student:Student)
CREATE (student)<-[:HELPS]-(teacher)
;
The result of a profile looks like:
- Empty Result
- Update Graph
- Eager
- Filter(0)
- SimplePatternMatcher
- SchemaIndex(0)
- SchemaIndex(1)
- ColumnFilter
- Filter(1)
- Extract
- Slice
- LoadCSV
Someone recommended optional matches here, which I attempted to do on the last match:
OPTIONAL MATCH (bully)-[:LOVES]->(student:Student)
WHERE student IS NOT NULL
This resulted in the error:
Other node is null.
I also tried limiting the student match to return only a single student, but this didn't work either. However, I don't think I'm doing it correctly, where I add WITH student LIMIT 1.
Does anyone have recommendations for how to reduce the number of eagers? Without the create at the end, I don't get an eager, and with it I do.
Following Stefan's suggestion, I'm no longer getting an eager, but I am getting the "Other node is null" error.
- Empty Result
- UpdateGraph
- Optional Match
- SchemaIndex(0)
- SchemaIndex(1)
- Slice
- ColumnFilter
- Filter(0)
- Extract
- LoadCSV
- Filter(1)
- SimplePatternMatcher
- Argument
At least in 2.2.2 the following seems not to have an
eager
:The error "other node is null" seems to pop up when doing an optional match with a label on the other end.