< 1st query >
match (d:Document)-[:HAS_WORD]->(w:Word) where d.site = 1
return w.word order by w.word
==> it returns 6604 records(displaying 1000) under 1 second.
< 2nd query : same with the 1st query except "limit xxx" >
match (d:Document)-[:HAS_WORD]->(w:Word) where d.site = 1
return w.word order by w.word limit 100
==> it runs a circle(processing) and looks to take forever to be finished.
I checked the query plan by "explain":
1st query starts with NodeIndexSeek d / BTREE INDEX d:Document(siteName) WHERE siteName = $autoint_0
2nd query starts with NodeIndexScan r / BTREE INDEX r:Word(word) WHERE word IS NOT NULL, cache[r.word]
Why the query plan is so different? Is it the cause of the problem of the 2nd query? How can I solve the problem and display the list in a limited length to review them? It is tested on Neo4j Enterprise 4.4.8.