我有以下查询:
MATCH
(per:Person)-[:RELATES_TO]->(f:FOO)
-[:Function_FOO]->(:ENTRY)
-[:FLOWS*]->()
-[:PARENT*]->(call:CallExpr)
-[:PARENT*]->(:Callee {name:'AAA'})
RETURN DISTINCT call.name
LIMIT 176
这运行时间为270毫秒,但是当我将LIMIT更改为177时,它会一直运行。我是否需要以另一种方式运行查询以阻止此行为?
这是计划
----------------
NodeIndexSeek
:Callee(name)
8 estimated rows
210 db hits
209 rows
-----------------
|
|
-----------------
VarLengthExpand(All)
call
(UNAMED170)<-[UNNAMED150:PARENT*]-(call)
8 estimated rows
2896 db hits
1343 rows
-----------------
|
|
-----------------
Filter
call
call:CallExpr
8 estimated rows
1343 db hits
212 rows
-------------------
|
|
-------------------
VarLengthExpand(All)
call
(call)<-[UNNAMED104:PARENT*]-(UNAMED102)
0 estimated rows
2509 db hits
-----------------
|
|
-----------------
Filter
call
none(anon[104] in anon[104] where any(anon[150] in anon[150] where anon[104] == anon[150]))
0 estimated rows
0 db hits
1148 rows
-------------------
|
|
-----------------
VarLengthExpand(All)
call
(UNAMED102)<-[UNNAMED87:FLOWS*]-(UNNAMED72)
0 estimated rows
95379 db hits
-----------------
|
|
-----------------
Filter
call
anon[72]:Entry
0 estimated rows
46189 db hits
1439 rows
-------------------
|
|
-------------------
Expand(All)
call, f
(UNNAMED72)<-[UNNAMED48: FUNCTION_FOO]-(f)
0 estimated rows
2878 db hits
1439 rows
-------------------
|
|
-------------------
Filter
call, f
f: FOO
0 estimated rows
1439 db hits
1439 rows
-----------------
|
|
-------------------
Expand(All)
call, f, per
(f)<-[UNNAMED18: RELATES_TO]-(per)
0 estimated rows
2878 db hits
1439 rows
-------------------
|
|
-------------------
Filter
call, f, per
per: Person
0 estimated rows
1439 db hits
1439 rows
-----------------
|
|
----------------
Distinct
call.name
0 estimated rows
1439 db hits
176 rows
-----------------
|
|
-----------------
Limit
call.name
Literal(176)
0 estimated rows
0 db hits
176 rows
-----------------
|
|
----------------
ProduceResults
call.name
0 estimated rows
0 db hits
176 rows
-----------------
|
|
--------
Result
---------
及以下是EXPLAIN命令的结果,LIMIT设置为177
----------------
NodeIndexSeek
:Callee(name)
8 estimated rows
-----------------
|
|
-----------------
VarLengthExpand(All)
call
(UNAMED170)<-[UNNAMED150:PARENT*]-(call)
8 estimated rows
-----------------
|
|
-----------------
Filter
call
call:CallExpr
8 estimated rows
-------------------
|
|
-------------------
VarLengthExpand(All)
call
(call)<-[UNNAMED104:PARENT*]-(UNAMED102)
0 estimated rows
-----------------
|
|
-----------------
Filter
call
none(anon[104] in anon[104] where any(anon[150] in anon[150] where anon[104] == anon[150]))
0 estimated rows
-------------------
|
|
-----------------
VarLengthExpand(All)
call
(UNAMED102)<-[UNNAMED87:FLOWS*]-(UNNAMED72)
0 estimated rows
-----------------
|
|
-----------------
Filter
call
anon[72]:Entry
0 estimated rows
-------------------
|
|
-------------------
Expand(All)
call, f
(UNNAMED72)<-[UNNAMED48: FUNCTION_FOO]-(f)
0 estimated rows
-------------------
|
|
-------------------
Filter
call, f
f: FOO
0 estimated rows
-----------------
|
|
-------------------
Expand(All)
call, f, per
(f)<-[UNNAMED18: RELATES_TO]-(per)
0 estimated rows
-------------------
|
|
-------------------
Filter
call, f, per
per: Person
0 estimated rows
-----------------
|
|
----------------
Distinct
call.name
0 estimated rows
-----------------
|
|
-----------------
Limit
call.name
Literal(177)
0 estimated rows
-----------------
|
|
----------------
ProduceResults
call.name
0 estimated rows
-----------------
|
|
--------
Result
---------