I am designing a brand new application, which relies a lot on dates. Basically, every query I make starts with a range of dates. I made a date tree like this :
(:Date)-[:NEXT_DAY]->(:Date)-[:NEXT_DAY]-> ....
I found that using [:NEXT_DAY]
relations is very efficient to query ranges and ordering results.
I have many documents linked to these days :
(:Document)-[:PUBLISHED_ON]->(:Day)
The more basic query is to match all the documents published along the date path. This is my actual query :
MATCH DatePath = (b:Date)-[:NEXT*30]->(e:Date {day:20150101})
UNWIND nodes(DatePath) as date
WITH date
MATCH (doc:Document)-[:PUBLISHED_ON]->(date)
RETURN count(doc)
The query above takes almost a second to return less than 30K nodes. So my question is : is it a normal behaviour? Or maybe there is a better way to match relationships along path?