我有一些查询在where子句中执行“ perm”检查。或多或少看起来像这样:
where (r IS NULL) and ((team.visibility = 6)
or ((team.visibility = 3) and (user)-[:FRIEND]- (:User{userid:team.owner}))
or ((team.visibility = 4) and (user)-[:FRIEND*1..2]-(:User{userid:team.owner}))
or ((team.visibility = 5) and (user)-[:FRIEND]-(:User)-[:HAS]->(:UserTeamRef)-[:JOINED]->(team)))
比赛(团队)<-[:: JOINED | SUSPENDED]-(成员:UserTeamRef)
team.visibility = 4的“朋友之友”(泡沫)显然是一项昂贵的操作。即使我要测试的数据集中没有可见性= 4的团队,它也会对每个查询执行。
我的期望是该查询有98%的时间会短路team.visibility = 6,因为98%的团队具有该烫发值。我还希望在可见性= 4的团队数量为0的情况下,比赛永远不会发生。
有什么作用?