I want to find all the paths from the leaf node(E) to the root node(A). (Not for any specific node, so no id or filed filter here)
The data model is as shown in the image.
I used a basic Cypher query to find the paths (A to E):
MATCH path=(:A)-[:USE*]->(:E) RETURN path
It keeps running and never finishes.
I tried to get the paths from C to E using:
MATCH path=(:C)-[:USE*]->(:E) RETURN path
This is query takes up to 18 seconds to return 18k paths. I have tried USING SCAN but no improvements in the time.
How can I improve this traversal to return results in less time? I need to get the results in 4-5 seconds.
System Configurations:
System memory is 32GB
Storage: SSD
Current Neo4j Conf:
heap size: initial-12GB max-12GB
cache: 12GB
Database size: 1.6GB