to populate an empty graph, where nodeID has been created as one index. I have two questions:
I read the difference between MERGE ... ON MATCH SET and MERGE ... ON CREATE SET. It seems to me to build graph from scratch, I should use ON CREATE, but NO MATCH. But I don't understand why MERGE ... ON MATCH SET ... also successfully created the graph.
After the graph is built and I run the same code to rebuild it just for testing, and it takes the same amount of time to finish. Shouldn't it be much faster since all the nodes have already been created in the first pass?
@koji That's a good test case to illustrate the difference of the two. Still if I only execute:
MERGE (n:Sample {id: 1})
ON MATCH SET n.update_datetime = datetime();
The documentation says that "Merging nodes and setting properties on found nodes.". When the node '1' is not in the graph, it can't find it, so it should do nothing. That was my mistaken thought. Now I know that 'MERGE' itself also creates new nodes if not found. If not found, it will ignore the SET part, which is different from MERGE ON CREATE SET.