我一直在开发一款应用程序,用于在neo4j数据库的国际航班中查找给定价格下的路径。查询的响应时间在下面大约需要8分钟。数据库大约包含17个节点和它们之间的200个关系。为什么需要比平常更长的时间?
MATCH (strt:Airport {code:'ATH'}) WITH strt as s
MATCH nodes = (s:Airport)-[rs:Leg *]->(other:Airport)-[:Leg]->(s:Airport)
WHERE not other = s and 200 > reduce(totalPrice = 0, r IN rs | totalPrice + r.price) and ALL(idx in range(0, size(rs)-2) WHERE (rs[0]).date = 201800408210000 and (rs[idx]).date = (rs[idx+1]).date +3000000 )
WITH *, reduce(totalPrice = 0, r IN rs | totalPrice + r.price) as tp
RETURN collect(distinct nodes), tp
ORDER BY tp DESC