What is best way in String- Start WITH or Contains - Load CSV

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);

In general, in any string matching starts with will always outperform contains. Since you are looking at a value you already hold in memory and doing a starts with on a short string you are unlikely to see much of a difference, but the starts with should still be faster.

If you were querying nodes and filtering them by an indexed property, then with 'starts with' it would be able to leverage the index.

You will need to fix up your query... FOREACH is its own clause, you can't use that within ON CREATE SET.

Additionally, since it's its own clause, you can't use it between ON CREATE SET and ON MATCH SET. Those two clauses must be adjacent to each other, with no other clauses between.