配置文件查询
如果查询以EXPLAIN
开头,服务器将返回它用于运行查询的执行计划,但不会实际执行它。另一方面,如果查询以PROFILE
开头,服务器将返回执行计划以及相应的查询结果。
执行计划对于分析查询和分析其性能很有价值。有关更多信息,请参阅查询调整→分析查询.
示例请求
POST http://localhost:7474/db/neo4j/tx/commit
Accept: application/json;charset=UTF-8
Content-Type: application/json
Authorization: Basic bmVvNGo6dmVyeXNlY3JldA==
{
"statements": [
{
"statement": "EXPLAIN MATCH (n:Person {name: $name}) RETURN n.name",
"parameters": {
"name": "Peter"
}
}
]
}
示例响应
200: OK
Content-Type: application/json;charset=utf-8
{
"results": [ {
"columns": [ "n.name" ],
"data": [],
"plan": {
"root": {
"operatorType": "ProduceResults@neo4j",
"string-representation": "Planner COST\n\nRuntime PIPELINED\n\nRuntime version 5.12\n\nBatch size 128\n\n+------------------+----+---------------------------+----------------+---------------------+\n| Operator | Id | Details | Estimated Rows | Pipeline |\n+------------------+----+---------------------------+----------------+---------------------+\n| +ProduceResults | 0 | `n.name` | 1 | |\n| | +----+---------------------------+----------------+ |\n| +Projection | 1 | cache[n.name] AS `n.name` | 1 | |\n| | +----+---------------------------+----------------+ |\n| +Filter | 2 | cache[n.name] = $name | 1 | |\n| | +----+---------------------------+----------------+ |\n| +NodeByLabelScan | 3 | n:Person | 10 | Fused in Pipeline 0 |\n+------------------+----+---------------------------+----------------+---------------------+\n\nTotal database accesses: ?\n",
"Id": 0,
"planner-impl": "IDP",
"runtime-version": "5.12",
"Details": "`n.name`",
"planner-version": "5.12",
"EstimatedRows": 0.5,
"planner": "COST",
"batch-size": 128,
"runtime": "PIPELINED",
"PipelineInfo": "Fused in Pipeline 0",
"runtime-impl": "PIPELINED",
"identifiers": [ "`n.name`" ],
"children": [ {
"operatorType": "Projection@neo4j",
"Details": "cache[n.name] AS `n.name`",
"EstimatedRows": 0.5,
"PipelineInfo": "Fused in Pipeline 0",
"Id": 1,
"identifiers": [ "`n.name`" ],
"children": [ {
"operatorType": "Filter@neo4j",
"Details": "cache[n.name] = $name",
"EstimatedRows": 0.5,
"PipelineInfo": "Fused in Pipeline 0",
"Id": 2,
"identifiers": [ "n" ],
"children": [ {
"operatorType": "NodeByLabelScan@neo4j",
"Details": "n:Person",
"EstimatedRows": 10.0,
"PipelineInfo": "Fused in Pipeline 0",
"Id": 3,
"identifiers": [ "n" ],
"children": []
} ]
} ]
} ]
}
}
} ],
"errors": []
}