cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Cypher optimitization

Hi Michael,
I need your help in optimising this cypher query to run pretty much faster preferably in milliseconds.

match (c:client{client_id:$var3}) optional match (d:client) where (c.address =d.address or c.employer =d.employer) and c<>d and d.status ='WRITE_OFF' return count(distinct d)

Thanks so much.

1 ACCEPTED SOLUTION

Please share the expanded query plan with PROFILE

Make sure to have an index on employer and addres
Perhaps a union would work better than the OR

How many status do you have?

View solution in original post

2 REPLIES 2

Please share the expanded query plan with PROFILE

Make sure to have an index on employer and addres
Perhaps a union would work better than the OR

How many status do you have?

Hi Michael,
Thanks for your help. Having indexes on both employer and address solved the problem.