Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Expect disruption to service on Thursday, Feb. 9!

UNWIND vs mapParallel to run a query on a given set



I was thinking to use mapParallel instead of UNWIND to run the query on a set in parallel using the system resource. This gave me the same execution time to return the result.

CALL apoc.cypher.mapParallel('Optional Match(:VideoFeed {pyid: _})<-[rr :HAS_VIEWED {skip:false}]-(:User) RETURN SUM(rr.views) as count', {}, ["a", "b", "c", "d","e"]) yield value RETURN value.count

UNWIND [{Idx:0, Id:"a"}, {Idx:1, Id:"b"}, {Idx:2, Id:"c"}, {Idx:3, Id:"d"}, {Idx:4, Id:"e"}] as row
Optional Match(:VideoFeed {pyid: row.Id})<-[rr :HAS_VIEWED {skip:false}]-(:User)
WITH row, SUM(rr.views) as count
RETURN count ORDER BY row.Id

Is this expected? Does UNWIND behave the same as mapParallel?

Also is the return order of mapParallel guaranteed to be the same as the input set?
For UNWIND, the order comes different. So I need to map with an index to make sure it is returned in the same way.