-
Notifications
You must be signed in to change notification settings - Fork 830
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
How to determine if the query was served by a specific shard using AQL Explain? #20529
Comments
For a simple query like Execution plan:
Id NodeType Site Calls Par Items Filtered Runtime [s] Comment
1 SingletonNode COOR 1 - 1 0 0.00000 * ROOT
7 SingleRemoteOperationNode COOR 1 - 1 0 0.00072 - FOR doc IN s FILTER doc.`_key` == "12345" /* primary index scan */
5 ReturnNode COOR 1 - 1 0 0.00000 - RETURN doc
Indexes used:
By Name Type Collection Unique Sparse Cache Selectivity Fields Stored values Ranges
7 primary primary s true false false 100.00 % [ `_key` ] [ ] "12345"
Optimization rules applied:
Id Rule Name Id Rule Name
1 use-indexes 3 remove-unnecessary-calculations-2
2 remove-filter-covered-by-index 4 optimize-cluster-single-document-operations
Query Statistics:
Writes Exec Writes Ign Doc. Lookups Scan Full Scan Index Cache Hits/Misses Filtered Requests Peak Mem [b] Exec Time [s]
0 0 0 0 1 0 / 0 0 0 0 0.00106 The The explain output doesn't include The optimizer rule is not eligible if you filter for two different documents, like Execution plan:
Id NodeType Site Calls Par Items Filtered Runtime [s] Comment
1 SingletonNode DBS 3 - 3 0 0.00001 * ROOT
7 IndexNode DBS 3 0 2 0 0.00033 - FOR doc IN s /* primary index scan, index scan + document lookup, 3 shard(s) */
10 RemoteNode COOR 9 - 2 0 0.00005 - REMOTE
11 GatherNode COOR 4 - 2 0 0.00005 - GATHER /* parallel, unsorted */
5 ReturnNode COOR 4 - 2 0 0.00001 - RETURN doc
Indexes used:
By Name Type Collection Unique Sparse Cache Selectivity Fields Stored values Ranges
7 primary primary s true false false 100.00 % [ `_key` ] [ ] (doc.`_key` IN [ "12345", "54324" ])
Optimization rules applied:
Id Rule Name Id Rule Name Id Rule Name
1 replace-or-with-in 4 remove-unnecessary-calculations-2 7 parallelize-gather
2 use-indexes 5 scatter-in-cluster 8 async-prefetch
3 remove-filter-covered-by-index 6 remove-unnecessary-remote-scatter
Query Statistics:
Writes Exec Writes Ign Doc. Lookups Scan Full Scan Index Cache Hits/Misses Filtered Requests Peak Mem [b] Exec Time [s]
0 0 2 0 2 0 / 0 0 9 0 0.00330 The rule is also not applicable when you query a View, even when asking only for a single document. When using custom shard keys (not Execution plan:
Id NodeType Site Par Est. Comment
1 SingletonNode DBS 1 * ROOT
2 EnumerateCollectionNode DBS ✓ 100000 - FOR doc IN t /* full collection scan, shard: s8010016 */ FILTER (doc.`sk` == 4) /* early pruning */
8 RemoteNode COOR 100000 - REMOTE
9 GatherNode COOR 100000 - GATHER /* parallel, unsorted */
5 ReturnNode COOR 100000 - RETURN doc When asking for multiple shards, like Execution plan:
Id NodeType Site Par Est. Comment
1 SingletonNode DBS 1 * ROOT
2 EnumerateCollectionNode DBS ✓ 100000 - FOR doc IN t /* full collection scan, 3 shard(s) */ FILTER (doc.`sk` IN [ 1, 4 ]) /* early pruning */
8 RemoteNode COOR 100000 - REMOTE
9 GatherNode COOR 100000 - GATHER /* parallel, unsorted */
5 ReturnNode COOR 100000 - RETURN doc You can also observe the difference in the profiling output by looking at the Using an |
Hi,
We have a sharded deployment of our ArangoDB and wanted to know how do I determine if a query utilized the shard key to direct the query to a specific shard using AQL explain in case of a) collection b) ArangoSearch view ?
The text was updated successfully, but these errors were encountered: