on default setup of Neo4j, I build up database with query
CREATE (R1:resource { name : '1' }),
(R2:resource { name : '2' }),
(R3:resource { name : '2' }),
(F1:facility { name : '1' }),
(F2:facility { name : '2' }),
(F10)-[:OUT]->(R6),
(R6)-[:IN]->(F3)
for simplicity, i wrote part of query. To explain, I have 8 resources and 25 facilities, facilities out or in resources with relations. I have 1000 relations randomly generated, Now I query database with
match (m:facility)-[:OUT]->(n:resource)
-[:IN]->(k:facility)-[:OUT]->(l:resource)
-[:IN]->(o:facility) return m,n,k,l,o
but it takes more than 15 minutes. Isn't this weird Please help Thx
:IN
and:OUT
relationships, if cycles in that relationship pattern are possible then your query seems like it's evaluating every path between every set of nodes in your DB. You should place some constraints on whatm
is, and you should probably specifyWHERE m<>k AND k<>o AND n<>l AND l<>o
. – FrobberOfBits