I'm writing a template for a query that returns a list of test scores with relevant information. With a sample dataset on Neo4j Community they are taking a long time.
Here's an example,
// Marks that were ranked top 10 on that test, and performed during a
section between 2015-1-1 and 2016-02-07
MATCH (mark:Mark)-[r1:PERFORMED_BY]->(prsn:Person)
MATCH (mark:Mark)-[r2:PERFORMED_ON]->(test:Test)
MATCH (mark:Mark)-[r3:PERFORMED_FOR]->(course:Course)
MATCH (mark:Mark)-[r4:PERFORMED_DURING]->(sect:Section)
MATCH (s:Section)-[r5:LOCATED_IN]->(room:Room)
WHERE r2.rank in range(1,10) AND sect.datetime in range(1420099200000,1494831600000,100000)
RETURN mark.uid, prsn.uid, test.uid, course.uid, sect.uid, mark.score, course.datetime, prsn.name, course.title, room.number
r1.class, r2.rank, r3.rank
ORDER BY mark.score
The simplest of queries WHERE r2.rank = 1
can take a a few seconds. When using the range operator it will take 30+ seconds. Are there any strategies in which can I can tune the query?
Neo4j Community 3.1.1
Store info
- Array Store 8.00 KiB
- Logical Log 17.05 MiB
- Node Store 143.96 KiB
- Property Store 1.67 MiB
- Relationship Store 1.28 MiB
- String Store Size 72.00 KiB
- Total Store Size 29.54 MiB
Node id info
- Node ID 9463
- Property ID 42673
- Relationship ID 39466
- Relationship Type ID 12