cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 2: migrate recent content

Return "result limit xxx" runs forever?!

Dongho
Node Clone

< 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.

2 REPLIES 2

Dongho
Node Clone

Now I found it(with limit xxx) works normal without "where d.siteName=1" condition.

What's wrong with  "where d.siteName=1" in my query? How can I avoid this problem? I need to review the list by its siteName on the monitor.

Hello @Dongho 🙂

What are you trying to achieve with your query? Can you share your data model? On which properties did you create indexes/constraints?

Regards,
Cobra