1
votes

So I created a date dimension from this article a link

I modified it and added datestamp to Day node which is Month/Day/Year (string)

I added indexes on Year.year, Month.month, Day.day && day.datestamp

When I run this query:

MATCH p=(day2:Day {datestamp:'1/1/2015'})-[:NEXT*]->(day {day:2}) return length(p) limit 5

It takes 1667 ms to execute

When I modify the query to this:

MATCH p=(day2:Day {datestamp:'1/1/2015'})-[:NEXT*]->(day {datestamp:'1/2/2015'}) return length(p)

After it runs for about a minute, it ends in the Unknown Error message.

My schema is:

Indexes

ON :Day(day) ONLINE
ON :Day(datestamp) ONLINE
ON :Month(month) ONLINE
ON :Year(year) ONLINE

No constraints

Any ideas what I'm doing wrong?

1
Could you share your database somewhere? Seems to be an interesting problem. Also which Neo4j version are you running?Michael Hunger
Can you try to run MATCH p=shortestPath(day2:Day {datestamp:'1/1/2015'})-[:NEXT*]->(day {day:2}) return length(p) limit 5Michael Hunger

1 Answers

0
votes

I think I figured it out.

Looks like the 1st query that runs 1667ms only runs and completes because of limit 5, it finds 5 records and stops further execution.

While the other keeps going and going until it runs out of juice.

I think solution in this case is constraint that indicates datestamp is unique which should prevent further execution.

Still interesting, considering there's about 2600+ records connected with HAS_NEXT so traveling through those relationships shouldn't be taking this long to find out that there's only 1 record that matches that query.