Get SQL execution details

View the complete information of a SQL execution record to confirm the statement content, execution status, time consumption and error information. 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/detail

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/detail" \
  -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",
    "transaction_id": "txn-01",
    "session_id": "session-01",
    "account": "acc01",
    "user": "analyst",
    "host": "127.0.0.1",
    "database": "analytics",
    "statement": "SELECT 1 AS n",
    "request_at": "2026-08-26T09:45:35Z",
    "response_at": "2026-08-26T09:45:36Z",
    "duration": 1000000,
    "status": "Success",
    "statement_type": "Select",
    "query_type": "DQL",
    "sql_source_type": "cloud_user_sql",
    "result_count": 1
  }
}

Field

Type

Description

data.statement_id

string

Statement ID.

data.transaction_id

string

Transaction ID.

data.session_id

string

Session ID.

data.account

string

Account used for execution.

data.user

string

Executing user.

data.host

string

Execution host.

data.database

string

The database used during execution.

data.statement

string

SQL statement text.

data.statement_tag

string

Statement label.

data.statement_fingerprint

string

Sentence fingerprint.

data.node_uuid

string

Execution node UUID.

data.node_type

string

Execution node type.

data.request_at

string

Start execution time.

data.response_at

string

End execution time.

data.duration

integer

Execution duration, in nanoseconds.

data.status

string

execution status.

data.error_code

string

error code.

data.error

string

error message.

data.exec_plan

string

Saved execution plan.

data.rows_read

integer

Read the number of lines.

data.bytes_scan

integer

Number of bytes to scan.

data.statement_type

string

Statement type.

data.query_type

string

Statement category.

data.role_id

integer

Execution role ID.

data.sql_source_type

string

SQL source type.

data.result_count

integer

Number of result rows.

data.cu

number

Capacity usage.

data.connection_id

integer

Database connection ID.

When you need to view the execution plan, use the same statement ID and time range query SQL execution plan. If you need to re-execute, after confirming the SQL content, target database and current identity permissions, use Execute SQL.

Error response

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

Field

Type

Description

code

string

error code.

msg

string

error message.

Last updated on