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",
"options" : {
"maxNumberOfPlans" : 2,
"allPlans" : true,
"optimizer" : {
"rules" : [
"-all",
"+use-index-for-sort",
"+use-index-range"
]
}
}
}
EOF
HTTP/1.1 OK
content-type: application/json; charset=utf-8
x-content-type-options: nosniff
{
"plans" : [
{
"nodes" : [
{
"type" : "SingletonNode",
"dependencies" : [ ],
"id" : 1,
"estimatedCost" : 1,
"estimatedNrItems" : 1
},
{
"type" : "IndexNode",
"dependencies" : [
1
],
"id" : 11,
"estimatedCost" : 11,
"estimatedNrItems" : 10,
"outVariable" : {
"id" : 0,
"name" : "p"
},
"projections" : [ ],
"producesResult" : true,
"database" : "_system",
"collection" : "products",
"satellite" : false,
"needsGatherNodeSort" : true,
"indexCoversProjections" : false,
"indexes" : [
{
"id" : "70098",
"type" : "skiplist",
"name" : "idx_1646382074276347906",
"fields" : [
"id"
],
"selectivityEstimate" : 1,
"unique" : false,
"sparse" : false,
"deduplicate" : true
}
],
"condition" : {
},
"sorted" : true,
"ascending" : true,
"reverse" : false,
"evalFCalls" : true,
"limit" : 0
},
{
"type" : "CalculationNode",
"dependencies" : [
11
],
"id" : 3,
"estimatedCost" : 21,
"estimatedNrItems" : 10,
"expression" : {
"type" : "attribute access",
"typeID" : 35,
"name" : "id",
"subNodes" : [
{
"type" : "reference",
"typeID" : 45,
"name" : "p",
"id" : 0
}
]
},
"outVariable" : {
"id" : 1,
"name" : "a"
},
"canThrow" : false,
"expressionType" : "attribute"
},
{
"type" : "CalculationNode",
"dependencies" : [
3
],
"id" : 4,
"estimatedCost" : 31,
"estimatedNrItems" : 10,
"expression" : {
"type" : "compare ==",
"typeID" : 25,
"excludesNull" : false,
"subNodes" : [
{
"type" : "reference",
"typeID" : 45,
"name" : "a",
"id" : 1
},
{
"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" : 41,
"estimatedNrItems" : 10,
"inVariable" : {
"id" : 4,
"name" : "3"
}
},
{
"type" : "CalculationNode",
"dependencies" : [
5
],
"id" : 6,
"estimatedCost" : 51,
"estimatedNrItems" : 10,
"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" : "CalculationNode",
"dependencies" : [
6
],
"id" : 7,
"estimatedCost" : 61,
"estimatedNrItems" : 10,
"expression" : {
"type" : "attribute access",
"typeID" : 35,
"name" : "id",
"subNodes" : [
{
"type" : "reference",
"typeID" : 45,
"name" : "p",
"id" : 0
}
]
},
"outVariable" : {
"id" : 6,
"name" : "5"
},
"canThrow" : false,
"expressionType" : "attribute"
},
{
"type" : "LimitNode",
"dependencies" : [
7
],
"id" : 9,
"estimatedCost" : 62,
"estimatedNrItems" : 1,
"offset" : 0,
"limit" : 1,
"fullCount" : false
},
{
"type" : "ReturnNode",
"dependencies" : [
9
],
"id" : 10,
"estimatedCost" : 63,
"estimatedNrItems" : 1,
"inVariable" : {
"id" : 2,
"name" : "name"
},
"count" : true
}
],
"rules" : [
"use-index-for-sort"
],
"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" : 63,
"estimatedNrItems" : 1,
"initialize" : true,
"isModificationQuery" : false
}
],
"warnings" : [ ],
"stats" : {
"rulesExecuted" : 3,
"rulesSkipped" : 33,
"plansCreated" : 1
},
"error" : false,
"code" : 200
}