-
Notifications
You must be signed in to change notification settings - Fork 852
very simple aql,slow query,took 47s #10898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Please provide the query execution plan for this query. You can retrieve it from the ArangoShell (arangosh) or the ArangoDB web interface. Without such information it is impossible to give you a sound answer. The usual suspects for slow query performance are:
|
|
Indeed an index is used, but it has a selectivity of 0.00% (only two digits after the decimal separator are shown in the explain output). The optimizer estimates that there are 57,227 documents to return, out of 290,000. This is just an estimation, but it shows that the index in general does not seem to be so helpful. According to these figures, there are only about 6 different values present in the data for |
Hi @caozku, Did you have the chance to read jsteemann's comment about using combined indexes ? Please let us know |
I have already added agentId and processing,it doesn't work! But how to use combined indexes. |
With the arangosh, you can use the command |
I added these two at first. |
Ok, so can you confirm you have that combined index in place? |
Thank you very much! This problem is solved.I have another question,if I have two documents to query,the aql is “for t in ocr_task filter t.hasDone == 1 for b in ocr_batch filter b._key == t.batchId and b.userKey == "657446338" collect with count into length return length”,how can I make it fast? |
I have another database.there id a document with 2.9 million pieces of data,when I execute the aql "for c in ChinaRoots_gImages filter c._key == "1054747628" update c with {hasDone:1,processing:0,postTime:DATE_NOW(),status:1} in ChinaRoots_gImages OPTIONS { exclusive: true }",it tooks more than 110s |
the query execution plan for this query is:
|
Re #10898 (comment):
(i.e. removing the FOR loop entirely) because it is a single-document primary key update and the update does not refer to any existing values in the to-be-updated document. The main problem with this query is thus likely the |
Re #10898 (comment):
I can't tell how to make this fast because I have no idea what indexes exist here and how many documents the underlying collections contain. It would be good to post the query's profile or execution plan in this Github issue to get at least some idea about the number of documents plus index usage. |
|
The bottleneck in this query seems to be the
It will find all matching documents in |
Hi @caozku, Did you have a chance to read jsteemann's latest reply? Could you please try to replace the existing index on |
Hi @caozku, Since we have not heard back from you recently, I am closing this issue for now. |
arangodb version 3.5.3,I have more than 290 thousand documents,when I execute a very simple query aql,it tooks 47s or even more time.I have created all indexs,Why is it so slow?
this is my aql :
[8bcee] slow query: 'for t in ocr_task filter t.agentId == "ocrAgent3" and t.processing == 1 and t.hasFail != 1 return t', took: 47.356403 s
The text was updated successfully, but these errors were encountered: