USING PERIODIC COMMIT 500
I am trying to load a csv and based on the the departmentId field starting with SUB_ then create the Label on node as ChildDepartment or ignore it.
Here i know that SUB_ will be present only in case its Child, so i can also use Contains.
I wants to check which one has good performance. or both are same.
Also Is it good to go with regex.
LOAD CSV WITH HEADERS FROM 'file:///data.csv' AS row
MERGE (dept:Department {DepartmentId: row.departmentId})
ON CREATE SET dept.Name=row.Name, dept.Count=row.count, acc.ChangedDate=timestamp(), acc.CreatedDate=timestamp(),
FOREACH (_ IN case WHEN row.departmentId STARTS WITH 'SUB_' then [1] else end | SET dept:SubDepartment)
ON MATCH acc.ChangedDate=timestamp()
RETURN count(dept);