0
MATCH (pr:PR)-[:CLOSED_ON]-(cls)  
WHERE  NOT(cls.closedDate = '' )  
RETURN pr

Execution time : 588 ms

MATCH (pr:PR)-[:CLOSED_ON]-(cls)  
WHERE  NOT(cls.closedDate = '' ) 
AND apoc.date.parse(cls.closedDate,'s', 'MM/dd/yyyy') >= apoc.date.parse('01/01/2014','s', 'MM/dd/yyyy') 
AND apoc.date.parse(cls.closedDate,'s', 'MM/dd/yyyy') <= apoc.date.parse('06/13/2017','s', 'MM/dd/yyyy') 
RETURN pr

Execution time : 2926 ms

Number of pr Node : 35,000

Why it take more time on more where statement?

enter image description here

Swapnil
  • 1,424
  • 2
  • 19
  • 30
  • You should add labels to your nodes. Currently this query is performing an all nodes scan to find the pattern in question which will not perform well as your data grows. Please add in the appropriate labels in your query. Also, if you can add an ms timestamp property to your `cls` node, then by adding an index for that property you can perform a very quick lookup to cls nodes in the given range. – InverseFalcon Dec 04 '17 at 08:58
  • Also, if you can run a PROFILE on the query, please expand all elements of the query plan and add the image to your description. – InverseFalcon Dec 04 '17 at 09:00
  • @InverseFalcon Added the image – Swapnil Dec 04 '17 at 09:06
  • Thanks. Do you have labels on your nodes? If so, can you add those to the query? If not, can you apply whatever relevant labels you can to `pr` and `cls` nodes? – InverseFalcon Dec 04 '17 at 09:49
  • @InverseFalcon Added the label and updated the question accordingly – Swapnil Dec 04 '17 at 10:05
  • 2
    Since your predicates are on the `cls` node, it's probably more efficient to start from your `cls` nodes. Is there a label on these? And can you add a new parameter to these nodes which has the timestamp value of the date (in milliseconds)? If you can avoid having to convert the property, then you can create an index on the property and get a fast lookup to `cls` nodes. – InverseFalcon Dec 04 '17 at 10:14

0 Answers0