The single most expensive mistake
CREATE vs MERGE
- CREATE always inserts new nodes / relationships. Two runs = two copies.
- MERGE runs MATCH-or-CREATE in a single atomic operation. Two runs = one copy.
MERGE supports two side blocks:
ON CREATE SET— only when this is the first time we see it.ON MATCH SET— only when it already existed.
Rule of thumb: any seeding / loading / sync code should use MERGE. CREATE is for one-shot facts you know don't exist yet (e.g. an audit log entry).