Get SQL execution profile

View the execution plan (Profile) of a SQL to analyze the execution steps and resource usage of the SQL. By default, only records executed by the current identity are viewed. When you have the corresponding permissions, you can view records in the workspace scope.

HTTP
POST $CLOUDSIGMA_API_BASE/query/profile

Before you call

Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. Prepare personal access token and current workspace ID with current workspace access rights. First query the SQL execution record, select the record to be analyzed and record its statement ID and execution time.

Request body

Replace $CLOUDSIGMA_API_KEY, $WORKSPACE_ID, $STATEMENT_ID in the example with actual values.

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/query/profile" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "statement_id": "'"$STATEMENT_ID"'",
    "start": "2026-08-26T09:44:00Z",
    "end": "2026-08-26T09:46:00Z"
  }'

Field

Type

Required

Description

scope

string or null

No

View the records of the current identity or current workspace. Values: empty string, self, workspace.

statement_id

string

Yes

The statement ID of the selected SQL execution record. Cannot be empty.

start

string

Yes

Query start time, using RFC 3339 format with time zone.

end

string

Yes

Query end time, using RFC 3339 format with time zone.

The start and end times use the RFC 3339 string with time zone, for example 2026-08-21T07:00:00Z. Detailed and scheduled queries retain the local time and microsecond precision of the input and extend the range by 1 seconds before and after. Lists and overviews are converted to UTC whole seconds.

View range

scope value

Viewable records

Permission conditions.

self

A record of current identity.

Default scope.

workspace

Workspace scope records.

Workspace audit read permission is required.

Specify query time range

The start and end time must be filled in at the same time and overwrite the execution time of the selected record. For example, when the list displays 2026-08-26T09:45:35Z, you can use 2026-08-26T09:44:00Z to The time range of 2026-08-26T09:46:00Z.

Use selected execution record

Populate the Statement ID field with the statement ID of the selected record. Fill in the start and end time, and the range must cover the recorded execution time.

Successful response

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "statement_id": "5c6f22fb-ef0e-4f46-b06f-c31e1a7afb48",
    "profile": {
      "code": 200,
      "message": "NO ExecPlan",
      "success": false
    }
  }
}

Field

Type

Description

data.statement_id

string

The statement ID in the request.

data.profile

object

Execution plan results.

data.profile.steps

array of object

List of steps to execute the plan.

data.profile.steps[].graphData

object

Execution plan diagram of steps.

data.profile.steps[].graphData.nodes

array of object

Execution nodes and their resource statistics in the execution plan graph.

data.profile.steps[].graphData.nodes[].id

string

logo.

data.profile.steps[].graphData.nodes[].name

string

Name.

data.profile.steps[].graphData.nodes[].title

string

title.

data.profile.steps[].graphData.nodes[].labels

array of object

Tag mapping.

data.profile.steps[].graphData.nodes[].labels[].name

string

Name.

data.profile.steps[].graphData.nodes[].labels[].value

string

Value.

data.profile.steps[].graphData.nodes[].statistics

object

Operational indicators.

data.profile.steps[].graphData.nodes[].statistics.memory

array of object or null

Memory metrics.

data.profile.steps[].graphData.nodes[].statistics.memory[].name

string

Name.

data.profile.steps[].graphData.nodes[].statistics.memory[].value

integer

Value.

data.profile.steps[].graphData.nodes[].statistics.memory[].unit

string

unit.

data.profile.steps[].graphData.nodes[].statistics.throughput

array of object or null

Throughput metrics.

data.profile.steps[].graphData.nodes[].statistics.throughput[].name

string

Name.

data.profile.steps[].graphData.nodes[].statistics.throughput[].value

integer

Value.

data.profile.steps[].graphData.nodes[].statistics.throughput[].unit

string

unit.

data.profile.steps[].graphData.nodes[].statistics.io

array of object or null

IO indicators.

data.profile.steps[].graphData.nodes[].statistics.io[].name

string

Name.

data.profile.steps[].graphData.nodes[].statistics.io[].value

integer

Value.

data.profile.steps[].graphData.nodes[].statistics.io[].unit

string

unit.

data.profile.steps[].graphData.nodes[].statistics.network

array of object or null

Network indicators.

data.profile.steps[].graphData.nodes[].statistics.network[].name

string

Name.

data.profile.steps[].graphData.nodes[].statistics.network[].value

integer

Value.

data.profile.steps[].graphData.nodes[].statistics.network[].unit

string

unit.

data.profile.steps[].graphData.nodes[].cost

object

Estimate cost.

data.profile.steps[].graphData.nodes[].cost.start

number

Start time.

data.profile.steps[].graphData.nodes[].cost.total

number

The number of records that match the current query conditions.

data.profile.steps[].graphData.nodes[].cost.card

number

Estimated base.

data.profile.steps[].graphData.nodes[].cost.ndv

number

Number of different values.

data.profile.steps[].graphData.nodes[].cost.rowsize

number

Estimate row size.

data.profile.steps[].graphData.nodes[].totalStats

object

Total operating indicators.

data.profile.steps[].graphData.nodes[].totalStats.name

string

Name.

data.profile.steps[].graphData.nodes[].totalStats.value

integer

Value.

data.profile.steps[].graphData.nodes[].totalStats.unit

string

unit.

data.profile.steps[].graphData.edges

array of object

Data flow relationships between execution nodes.

data.profile.steps[].graphData.edges[].id

string

logo.

data.profile.steps[].graphData.edges[].src

string

source node.

data.profile.steps[].graphData.edges[].dst

string

target node.

data.profile.steps[].graphData.edges[].output

integer

output.

data.profile.steps[].graphData.edges[].unit

string

unit.

data.profile.steps[].graphData.labels

array of object

Annotation information in the execution plan diagram.

data.profile.steps[].graphData.labels[].name

string

Name.

data.profile.steps[].graphData.labels[].value

string

Value.

data.profile.steps[].graphData.global

object

Summary resource statistics for steps.

data.profile.steps[].graphData.global.statistics

object

Operational indicators.

data.profile.steps[].graphData.global.statistics.memory

array of object or null

Memory metrics.

data.profile.steps[].graphData.global.statistics.memory[].name

string

Name.

data.profile.steps[].graphData.global.statistics.memory[].value

integer

Value.

data.profile.steps[].graphData.global.statistics.memory[].unit

string

unit.

data.profile.steps[].graphData.global.statistics.throughput

array of object or null

Throughput metrics.

data.profile.steps[].graphData.global.statistics.throughput[].name

string

Name.

data.profile.steps[].graphData.global.statistics.throughput[].value

integer

Value.

data.profile.steps[].graphData.global.statistics.throughput[].unit

string

unit.

data.profile.steps[].graphData.global.statistics.io

array of object or null

IO indicators.

data.profile.steps[].graphData.global.statistics.io[].name

string

Name.

data.profile.steps[].graphData.global.statistics.io[].value

integer

Value.

data.profile.steps[].graphData.global.statistics.io[].unit

string

unit.

data.profile.steps[].graphData.global.statistics.network

array of object or null

Network indicators.

data.profile.steps[].graphData.global.statistics.network[].name

string

Name.

data.profile.steps[].graphData.global.statistics.network[].value

integer

Value.

data.profile.steps[].graphData.global.statistics.network[].unit

string

unit.

data.profile.steps[].graphData.global.totalStats

object

Total operating indicators.

data.profile.steps[].graphData.global.totalStats.name

string

Name.

data.profile.steps[].graphData.global.totalStats.value

integer

Value.

data.profile.steps[].graphData.global.totalStats.unit

string

unit.

data.profile.steps[].step

integer

Step number.

data.profile.steps[].description

string

Step instructions.

data.profile.steps[].state

string

Step status.

data.profile.code

integer

Execution plan status code. Not less than 0. Not larger than 65535.

data.profile.message

string

Execution plan description. NO ExecPlan if there is no saved plan.

data.profile.success

boolean

Whether to obtain an available execution plan.

data.profile.uuid

string

Execution plan identifier.

When no execution plan is available, you can use the same statement ID and time range query SQL execution details, and check the SQL text and execution status.

Error response

JSON
{
  "code": "ErrParamInvalid",
  "msg": "请求参数无效"
}

Field

Type

Description

code

string

error code.

msg

string

error message.

Last updated on