查询SQL执行计划绑定情况
接口约束
仅支持包含有CN或DN(主、备)组件的节点。
调试
您可以在API Explorer中调试该接口。
URI
POST /v3/{project_id}/instances/{instance_id}/sql/{node_id}/plans/query
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
project_id |
是 |
String |
参数解释: 租户在某一Region下的项目ID。 获取方法请参见获取项目ID。 约束限制: 不涉及。 取值范围: 只能由英文字母、数字组成,且长度为32个字符。 默认取值: 不涉及。 |
|
instance_id |
是 |
String |
参数解释: 实例ID,此参数是用户创建实例的唯一标识。 约束限制: 不涉及。 取值范围: 只能由英文字母、数字组成,且长度为36个字符。 默认取值: 不涉及。 |
|
node_id |
是 |
String |
参数解释: 节点ID,仅支持非日志类型的CN或主DN、备DN节点。 约束限制: 不涉及。 取值范围: 只能由英文字母、数字组成,且长度为36个字符。 默认取值: 不涉及。 |
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
X-Auth-Token |
是 |
String |
参数解释: 用户Token。 通过调用IAM服务获取用户Token接口获取。 请求响应成功后在响应消息头中包含的“X-Subject-Token”的值即为Token值。 约束限制: 不涉及。 取值范围: 不涉及。 默认取值: 不涉及。 |
|
X-Language |
否 |
String |
参数解释: 语言。 约束限制: 不涉及。 取值范围:
默认取值: en-us |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
sql_id |
是 |
String |
参数解释: 归一化的SQL ID,获取方法请参见查询慢SQL列表。 约束限制: 不涉及。 |
|
page_size |
是 |
String |
参数解释: SQL执行计划每页显示数量。 约束限制: 不涉及。 取值范围: 整数,1~100。 默认取值: 不涉及。 |
|
offset |
是 |
String |
参数解释: SQL执行计划起始页码。 约束限制: 不涉及。 取值范围: 大于等于0的整数。 默认取值: 0 |
响应参数
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
total |
Integer |
参数解释: SQL执行计划总数。 取值范围: 不涉及。 |
|
sql_plan_bind_state_list |
Array of objects |
参数解释: 执行计划列表,详情请参见表5。 |
请求示例
查询SQL执行计划绑定情况。
POST https://gaussdb-opengauss.cn-north-1.myhuaweicloud.com/v3/99220a1a5b714977b61be98185636732in14/sql/60856bc060f1476b81af52a17e0e5fc7no14/plans/query
{
"offset" : 0,
"page_size" : 10,
"sql_id" : 418132115
}
响应示例
查询SQL执行计划成功。
{
"total" : 1,
"sql_plan_bind_state_list" : [ {
"outline" : "begin_outline_data\n use_hash_agg(@\"sel$1\")\n NestLoop(@\"sel$1\" root.store_sales@\"sel$1\" root.store_returns@\"sel$1\" root.store@\"sel$1\" root.customer@\"sel$1\" root.promotion@\"sel$1\" root.ad2@\"sel$1\" root.item@\"sel$1\")\n Leading(@\"sel$1\" ((((((root.store_sales@\"sel$1\" root.store_returns@\"sel$1\") root.store@\"sel$1\") root.customer@\"sel$1\") root.promotion@\"sel$1\") root.ad2@\"sel$1\") root.item@\"sel$1\"))\n NestLoop(@\"sel$1\" root.store_sales@\"sel$1\" root.store_returns@\"sel$1\" root.store@\"sel$1\" root.customer@\"sel$1\" root.promotion@\"sel$1\" root.ad2@\"sel$1\")\n Leading(@\"sel$1\" (((((root.store_sales@\"sel$1\" root.store_returns@\"sel$1\") root.store@\"sel$1\") root.customer@\"sel$1\") root.promotion@\"sel$1\") root.ad2@\"sel$1\"))\n NestLoop(@\"sel$1\" root.store_sales@\"sel$1\" root.store_returns@\"sel$1\" root.store@\"sel$1\" root.customer@\"sel$1\" root.promotion@\"sel$1\")\n Leading(@\"sel$1\" ((((root.store_sales@\"sel$1\" root.store_returns@\"sel$1\") root.store@\"sel$1\") root.customer@\"sel$1\") root.promotion@\"sel$1\"))\n NestLoop(@\"sel$1\" root.store_sales@\"sel$1\" root.store_returns@\"sel$1\" root.store@\"sel$1\" root.customer@\"sel$1\")\n Leading(@\"sel$1\" (((root.store_sales@\"sel$1\" root.store_returns@\"sel$1\") root.store@\"sel$1\") root.customer@\"sel$1\"))\n NestLoop(@\"sel$1\" root.store_sales@\"sel$1\" root.store_returns@\"sel$1\" root.store@\"sel$1\")\n Leading(@\"sel$1\" ((root.store_sales@\"sel$1\" root.store_returns@\"sel$1\") root.store@\"sel$1\"))\n HashJoin(@\"sel$1\" root.store_sales@\"sel$1\" root.store_returns@\"sel$1\")\n Leading(@\"sel$1\" (root.store_sales@\"sel$1\" root.store_returns@\"sel$1\"))\n TableScan(@\"sel$1\" root.store_sales@\"sel$1\")\n IndexOnlyScan(@\"sel$1\" root.store_returns@\"sel$1\" store_returns_pkey)\n IndexScan(@\"sel$1\" root.store@\"sel$1\" store_pkey)\n NestLoop_Index(@\"sel$1\" root.store@\"sel$1\", (root.store_sales@\"sel$1\"))\n IndexScan(@\"sel$1\" root.customer@\"sel$1\" customer_pkey)\n NestLoop_Index(@\"sel$1\" root.customer@\"sel$1\", (root.store_sales@\"sel$1\"))\n IndexOnlyScan(@\"sel$1\" root.promotion@\"sel$1\" promotion_pkey)\n NestLoop_Index(@\"sel$1\" root.promotion@\"sel$1\", (root.store_sales@\"sel$1\"))\n IndexScan(@\"sel$1\" root.ad2@\"sel$1\" customer_address_pkey)\n NestLoop_Index(@\"sel$1\" root.ad2@\"sel$1\", (root.customer@\"sel$1\"))\n IndexScan(@\"sel$1\" root.item@\"sel$1\" item_pkey)\n NestLoop_Index(@\"sel$1\" root.item@\"sel$1\", (root.store_sales@\"sel$1\"))\n version(\"1.0.0\")\n end_outline_data",
"cost" : "84178.87",
"status" : "bind",
"sql_hash" : "400834521",
"plan_id" : "378071839"
} ]
}
状态码
- 正常
- 异常
请参见状态码。
错误码
请参见错误码。