I am querying ArangoDb of about 500k document via arangojs.query()
with this very simple query
"FOR c IN Entity FILTER c.id == 261764 RETURN c"
It is a node in node-link graph.
But sometimes, it took more than 10 seconds and in the log of arangodb also has warning about query taking too long.Lots of time it happens if new session is used on browser. Is it problem of arangodb or arangojs or my query itself is not optimized?
-------------------Edit----------------------
Added db.explain
Query string:
FOR c IN Entity FILTER c.id == 211764 RETURN c
Execution plan:
Id NodeType Est. Comment
1 SingletonNode 1 * ROOT
2 EnumerateCollectionNode 140270 - FOR c IN Entity /* full collection scan */
3 CalculationNode 140270 - LET #1 = (c.`id` == 211764) /* simple expression */ /* collections used: c : Entity */
4 FilterNode 140270 - FILTER #1
5 ReturnNode 140270 - RETURN c
Indexes used:
none
Optimization rules applied:
none
As your Explain shows, your query doesn't utilize indices, but does a full collection scan.
Depending on when it finds the match (at the start or the end of the collection) execution times may vary.
See the Indexing chapter for creating indices, and the AQL Execution and Performance chapter howto analyse the output of db._explain()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.