neo4j语句优化
发布于 6 年前 作者 luoyenianhua 1759 次浏览 来自 问答

explain match(n:User{userId:1}) match(n)-[:gameSecond]->(game)<-[:gameSecond]-(m:User) where m.gender=2 and m.lastOnlineTimeStamp>0 and not (n)-[:friend]-(m) with n,m,count(game) as gs ,collect(game.name) as gameNameList optional match(n)-[:labelThird]->(table)<-[:labelThird]-(m)
with n,m,gs,gameNameList, count(table) as ds, collect(table.name) as labelNameList
return m.userId as userId, m.userName as userName, gameNameList,labelNameList, (0.4gs) + (0.2ds) - ABS(m.yearOfBirth-n.yearOfBirth)*0.4 as score order by score desc limit 1 有10万条数据,执行时间5s,plan.png

1 回复

大牛能指出优化方向吗

回到顶部