shell> curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/explain <<EOF
{
"query" : "FOR p IN products LET a = p.id FILTER a == 4 LET name = p.name SORT p.id LIMIT 1 RETURN name"
}
EOF
HTTP/1.1 OK
content-type: application/json; charset=utf-8
x-content-type-options: nosniff
{
"plan" : {
"nodes" : [
{
"type" : "SingletonNode",
"dependencies" : [ ],
"id" : 1,
"estimatedCost" : 1,
"estimatedNrItems" : 1
},
{
"type" : "IndexNode",
"dependencies" : [
1
],
"id" : 11,
"estimatedCost" : 4.3719280948873624,
"estimatedNrItems" : 1,
"outVariable" : {
"id" : 0,
"name" : "p"
},
"projections" : [
"name",
"id"
],
"producesResult" : true,
"database" : "_system",
"collection" : "products",
"satellite" : false,
"needsGatherNodeSort" : true,
"indexCoversProjections" : false,
"indexes" : [
{
"id" : "70066",
"type" : "skiplist",
"name" : "idx_1646382074264813570",
"fields" : [
"id"
],
"selectivityEstimate" : 1,
"unique" : false,
"sparse" : false,
"deduplicate" : true
}
],
"condition" : {
"type" : "n-ary or",
"typeID" : 63,
"subNodes" : [
{
"type" : "n-ary and",
"typeID" : 62,
"subNodes" : [
{
"type" : "compare ==",
"typeID" : 25,
"excludesNull" : false,
"subNodes" : [
{
"type" : "attribute access",
"typeID" : 35,
"name" : "id",
"subNodes" : [
{
"type" : "reference",
"typeID" : 45,
"name" : "p",
"id" : 0
}
]
},
{
"type" : "value",
"typeID" : 40,
"value" : 4,
"vType" : "int",
"vTypeID" : 2
}
]
}
]
}
]
},
"sorted" : true,
"ascending" : true,
"reverse" : false,
"evalFCalls" : true,
"limit" : 0
},
{
"type" : "CalculationNode",
"dependencies" : [
11
],
"id" : 4,
"estimatedCost" : 5.3719280948873624,
"estimatedNrItems" : 1,
"expression" : {
"type" : "compare ==",
"typeID" : 25,
"excludesNull" : false,
"subNodes" : [
{
"type" : "attribute access",
"typeID" : 35,
"name" : "id",
"subNodes" : [
{
"type" : "reference",
"typeID" : 45,
"name" : "p",
"id" : 0
}
]
},
{
"type" : "value",
"typeID" : 40,
"value" : 4,
"vType" : "int",
"vTypeID" : 2
}
]
},
"outVariable" : {
"id" : 4,
"name" : "3"
},
"canThrow" : false,
"expressionType" : "simple"
},
{
"type" : "FilterNode",
"dependencies" : [
4
],
"id" : 5,
"estimatedCost" : 6.3719280948873624,
"estimatedNrItems" : 1,
"inVariable" : {
"id" : 4,
"name" : "3"
}
},
{
"type" : "LimitNode",
"dependencies" : [
5
],
"id" : 9,
"estimatedCost" : 7.3719280948873624,
"estimatedNrItems" : 1,
"offset" : 0,
"limit" : 1,
"fullCount" : false
},
{
"type" : "CalculationNode",
"dependencies" : [
9
],
"id" : 6,
"estimatedCost" : 8.371928094887362,
"estimatedNrItems" : 1,
"expression" : {
"type" : "attribute access",
"typeID" : 35,
"name" : "name",
"subNodes" : [
{
"type" : "reference",
"typeID" : 45,
"name" : "p",
"id" : 0
}
]
},
"outVariable" : {
"id" : 2,
"name" : "name"
},
"canThrow" : false,
"expressionType" : "attribute"
},
{
"type" : "ReturnNode",
"dependencies" : [
6
],
"id" : 10,
"estimatedCost" : 9.371928094887362,
"estimatedNrItems" : 1,
"inVariable" : {
"id" : 2,
"name" : "name"
},
"count" : true
}
],
"rules" : [
"move-calculations-up",
"remove-redundant-calculations",
"remove-unnecessary-calculations",
"move-calculations-up-2",
"use-indexes",
"use-index-for-sort",
"remove-unnecessary-calculations-2",
"move-calculations-down",
"reduce-extraction-to-projection"
],
"collections" : [
{
"name" : "products",
"type" : "read"
}
],
"variables" : [
{
"id" : 6,
"name" : "5"
},
{
"id" : 4,
"name" : "3"
},
{
"id" : 2,
"name" : "name"
},
{
"id" : 1,
"name" : "a"
},
{
"id" : 0,
"name" : "p"
}
],
"estimatedCost" : 9.371928094887362,
"estimatedNrItems" : 1,
"initialize" : true,
"isModificationQuery" : false
},
"cacheable" : true,
"warnings" : [ ],
"stats" : {
"rulesExecuted" : 36,
"rulesSkipped" : 0,
"plansCreated" : 1
},
"error" : false,
"code" : 200
}