1
0
Fork 0
arangodb/Documentation/Examples/04_workWithAQL_profileQuery...

61 lines
2.4 KiB
Plaintext

arangosh> db._profileQuery(`
........> FOR u IN myusers
........> COLLECT ageGroup = FLOOR(u.age / 10) * 10
........> AGGREGATE minAge = MIN(u.age), maxAge = MAX(u.age), len = LENGTH(u)
........> RETURN {
........> ageGroup,
........> minAge,
........> maxAge,
........> len
........> }`, {}, {colors: false}
........> );
Query String (186 chars, cacheable: false):
FOR u IN myusers
COLLECT ageGroup = FLOOR(u.age / 10) * 10
AGGREGATE minAge = MIN(u.age), maxAge = MAX(u.age), len = LENGTH(u)
RETURN {
ageGroup,
minAge,
maxAge,
len
}
Execution plan:
Id NodeType Calls Items Runtime [s] Comment
1 SingletonNode 1 1 0.00000 * ROOT
2 EnumerateCollectionNode 1 20 0.00002 - FOR u IN myusers /* full collection scan */
3 CalculationNode 1 20 0.00002 - LET #5 = (FLOOR((u.`age` / 10)) * 10) /* simple expression */ /* collections used: u : myusers */
4 CalculationNode 1 20 0.00001 - LET #7 = u.`age` /* attribute expression */ /* collections used: u : myusers */
6 CollectNode 1 6 0.00002 - COLLECT ageGroup = #5 AGGREGATE minAge = MIN(#7), maxAge = MAX(#7), len = LENGTH(u) /* hash */
9 SortNode 1 6 0.00001 - SORT ageGroup ASC /* sorting strategy: standard */
7 CalculationNode 1 6 0.00001 - LET #11 = { "ageGroup" : ageGroup, "minAge" : minAge, "maxAge" : maxAge, "len" : len } /* simple expression */
8 ReturnNode 1 6 0.00000 - RETURN #11
Indexes used:
none
Optimization rules applied:
Id RuleName
1 move-calculations-up
2 remove-redundant-calculations
3 remove-unnecessary-calculations
4 move-calculations-up-2
5 move-calculations-down
Query Statistics:
Writes Exec Writes Ign Scan Full Scan Index Filtered Exec Time [s]
0 0 20 0 0 0.00056
Query Profile:
Query Stage Duration [s]
initializing 0.00000
parsing 0.00007
optimizing ast 0.00001
loading collections 0.00001
instantiating plan 0.00002
optimizing plan 0.00023
executing 0.00010
finalizing 0.00012