{
"basePath": "/",
"swaggerVersion": "1.1",
"apiVersion": "0.1",
"apis": [
{
"operations": [
{
"errorResponses": [
{
"reason": "If the query is valid, the server will respond with HTTP 200 and return a list of the individual query execution steps in the \"plan\" attribute of the response.
",
"code": "200"
},
{
"reason": "The server will respond with HTTP 400 in case of a malformed request, or if the query contains a parse error. The body of the response will contain the error details embedded in a JSON object. Omitting bind variables if the query references any will result also result in an HTTP 400 error.
",
"code": "400"
},
{
"reason": "The server will respond with HTTP 404 in case a non-existing collection is accessed in the query.
",
"code": "404"
}
],
"parameters": [
{
"dataType": "Json",
"paramType": "body",
"required": "true",
"name": "body",
"description": "The query string needs to be passed in the attribute query of a JSON object as the body of the POST request. If the query references any bind variables, these must also be passed in the attribute bindVars.
"
}
],
"notes": "
To explain how an AQL query would be executed on the server, the query string can be sent to the server via an HTTP POST request. The server will then validate the query and create an execution plan for it, but will not execute it.
The execution plan that is returned by the server can be used to estimate the probable performance of an AQL query. Though the actual performance will depend on many different factors, the execution plan normally can give some good hint on the amount of work the server needs to do in order to actually run the query.
The top-level statements will appear in the result in the same order in which they have been used in the original query. Each result element has at most the following attributes:
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/explain\n{ \"query\" : \"FOR p IN products FILTER p.id == @id LIMIT 2 RETURN p.name\", \"bindVars\": { \"id\" : 3 } }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"plan\" : { \n \"plan\" : { \n \"nodes\" : [ \n { \n \"type\" : \"SingletonNode\", \n \"dependencies\" : [ ], \n \"id\" : 1, \n \"estimatedCost\" : 1, \n \"depth\" : 0, \n \"varInfoList\" : [ ], \n \"nrRegs\" : [ ], \n \"regsToClear\" : [ ] \n }, \n { \n \"type\" : \"EnumerateCollectionNode\", \n \"dependencies\" : [ \n 1 \n ], \n \"id\" : 2, \n \"estimatedCost\" : 0, \n \"depth\" : 0, \n \"varInfoList\" : [ ], \n \"nrRegs\" : [ ], \n \"regsToClear\" : [ ], \n \"database\" : \"_system\", \n \"collection\" : \"products\", \n \"outVariable\" : { \n \"id\" : 0, \n \"name\" : \"p\" \n } \n }, \n { \n \"type\" : \"CalculationNode\", \n \"dependencies\" : [ \n 2 \n ], \n \"id\" : 3, \n \"estimatedCost\" : 0, \n \"depth\" : 0, \n \"varInfoList\" : [ ], \n \"nrRegs\" : [ ], \n \"regsToClear\" : [ ], \n \"expression\" : { \n \"type\" : \"compare ==\", \n \"subNodes\" : [ \n { \n \"type\" : \"attribute access\", \n \"name\" : \"id\", \n \"subNodes\" : [ \n { \n \"type\" : \"reference\", \n \"name\" : \"p\", \n \"id\" : 0 \n } \n ] \n }, \n { \n \"type\" : \"value\", \n \"value\" : 3 \n } \n ] \n }, \n \"outVariable\" : { \n \"id\" : 1, \n \"name\" : \"1\" \n }, \n \"canThrow\" : false \n }, \n { \n \"type\" : \"FilterNode\", \n \"dependencies\" : [ \n 3 \n ], \n \"id\" : 4, \n \"estimatedCost\" : 0, \n \"depth\" : 0, \n \"varInfoList\" : [ ], \n \"nrRegs\" : [ ], \n \"regsToClear\" : [ ], \n \"inVariable\" : { \n \"id\" : 1, \n \"name\" : \"1\" \n } \n }, \n { \n \"type\" : \"CalculationNode\", \n \"dependencies\" : [ \n 4 \n ], \n \"id\" : 6, \n \"estimatedCost\" : 0, \n \"depth\" : 0, \n \"varInfoList\" : [ ], \n \"nrRegs\" : [ ], \n \"regsToClear\" : [ ], \n \"expression\" : { \n \"type\" : \"attribute access\", \n \"name\" : \"name\", \n \"subNodes\" : [ \n { \n \"type\" : \"reference\", \n \"name\" : \"p\", \n \"id\" : 0 \n } \n ] \n }, \n \"outVariable\" : { \n \"id\" : 2, \n \"name\" : \"2\" \n }, \n \"canThrow\" : false \n }, \n { \n \"type\" : \"LimitNode\", \n \"dependencies\" : [ \n 6 \n ], \n \"id\" : 5, \n \"estimatedCost\" : 0, \n \"depth\" : 0, \n \"varInfoList\" : [ ], \n \"nrRegs\" : [ ], \n \"regsToClear\" : [ ], \n \"offset\" : 0, \n \"limit\" : 2 \n }, \n { \n \"type\" : \"ReturnNode\", \n \"dependencies\" : [ \n 5 \n ], \n \"id\" : 7, \n \"estimatedCost\" : 0, \n \"depth\" : 0, \n \"varInfoList\" : [ ], \n \"nrRegs\" : [ ], \n \"regsToClear\" : [ ], \n \"inVariable\" : { \n \"id\" : 2, \n \"name\" : \"2\" \n } \n } \n ], \n \"rules\" : [ \n \"move-calculations-up\", \n \"move-filters-up\", \n \"move-calculations-up-2\", \n \"move-filters-up-2\" \n ], \n \"collections\" : [ \n { \n \"name\" : \"products\", \n \"type\" : \"read\" \n } \n ], \n \"estimatedCost\" : 0 \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/explain\n{ \"query\" : \"FOR p IN products FILTER p.id == @id LIMIT 2 RETURN p.n\" }\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 400, \n \"errorNum\" : 1551, \n \"errorMessage\" : \"in state parsing: no value specified for declared bind parameter 'id'\" \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/explain\n{ \"query\" : \"FOR i IN [ 1, 2, 3 ] FILTER 1 == 2 RETURN i\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"plan\" : { \n \"plan\" : { \n \"nodes\" : [ \n { \n \"type\" : \"SingletonNode\", \n \"dependencies\" : [ ], \n \"id\" : 1, \n \"estimatedCost\" : 0, \n \"depth\" : 0, \n \"varInfoList\" : [ ], \n \"nrRegs\" : [ ], \n \"regsToClear\" : [ ] \n }, \n { \n \"type\" : \"CalculationNode\", \n \"dependencies\" : [ \n 1 \n ], \n \"id\" : 2, \n \"estimatedCost\" : 0, \n \"depth\" : 0, \n \"varInfoList\" : [ ], \n \"nrRegs\" : [ ], \n \"regsToClear\" : [ ], \n \"expression\" : { \n \"type\" : \"list\", \n \"subNodes\" : [ \n { \n \"type\" : \"value\", \n \"value\" : 1 \n }, \n { \n \"type\" : \"value\", \n \"value\" : 2 \n }, \n { \n \"type\" : \"value\", \n \"value\" : 3 \n } \n ] \n }, \n \"outVariable\" : { \n \"id\" : 1, \n \"name\" : \"1\" \n }, \n \"canThrow\" : false \n }, \n { \n \"type\" : \"NoResultsNode\", \n \"dependencies\" : [ \n 2 \n ], \n \"id\" : 7, \n \"estimatedCost\" : 0, \n \"depth\" : 0, \n \"varInfoList\" : [ ], \n \"nrRegs\" : [ ], \n \"regsToClear\" : [ ] \n }, \n { \n \"type\" : \"EnumerateListNode\", \n \"dependencies\" : [ \n 7 \n ], \n \"id\" : 3, \n \"estimatedCost\" : 0, \n \"depth\" : 0, \n \"varInfoList\" : [ ], \n \"nrRegs\" : [ ], \n \"regsToClear\" : [ ], \n \"inVariable\" : { \n \"id\" : 1, \n \"name\" : \"1\" \n }, \n \"outVariable\" : { \n \"id\" : 0, \n \"name\" : \"i\" \n } \n }, \n { \n \"type\" : \"ReturnNode\", \n \"dependencies\" : [ \n 3 \n ], \n \"id\" : 6, \n \"estimatedCost\" : 0, \n \"depth\" : 0, \n \"varInfoList\" : [ ], \n \"nrRegs\" : [ ], \n \"regsToClear\" : [ ], \n \"inVariable\" : { \n \"id\" : 0, \n \"name\" : \"i\" \n } \n } \n ], \n \"rules\" : [ \n \"move-calculations-up\", \n \"move-filters-up\", \n \"remove-unnecessary-filters\", \n \"remove-unnecessary-calculations\" \n ], \n \"collections\" : [ ], \n \"estimatedCost\" : 0 \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n