I've seen that sometimes CREATE
is used to create nodes, and in other situations, MERGE
is used. What's the difference, and when should one be used in place of another?
Asked
Active
Viewed 49 times
0

Kelvin Lawrence
- 14,674
- 2
- 16
- 38

KWriter
- 1,024
- 4
- 22
2 Answers
1
CREATE
does just what it says. It creates, and if that means creating duplicates, well then it creates.
MERGE
does the same thing as CREATE
, but also checks to see if a node already exists with the properties you specify. If it does, then it doesn't create. This helps avoid duplicates.
Here's an example: I use CREATE
twice to create a person with the same name.

Anton Menshov
- 2,266
- 14
- 34
- 55

Virat Mehar
- 26
- 2
0
CREATE
should be used when you are absolutely certain that the information doesn't exist in the database (for example, when you are loading data). MERGE
is used whenever there is a possibility that the node or relationship already exists and you don’t need to duplicate it. MERGE
shouldn't always be used as it’s considerably slower than the create clause.

KWriter
- 1,024
- 4
- 22