Help Center/ Data Admin Service/ API Reference/ APIs (in OBT)/ Intelligent O&M/ Exporting Details About All Query Logs
Updated on 2025-11-26 GMT+08:00

Exporting Details About All Query Logs

Function

After Collect All Query Logs is enabled, you can create a SQL Insight task to export details by node, username, database, and operation type. This function is available only for paid instances.

Authorization Information

Each account has permissions to call all APIs, but IAM users must have the required permissions specifically assigned.

  • If you are using role/policy-based authorization, see the required permissions in Permissions Policies and Supported Actions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: Required)

    Condition Key

    Alias

    Dependency

    das:clouddba:listFullSql

    list

    Instance

    -

    das:clouddba:fullSqlList

    -

URI

GET /v3/{project_id}/instances/{instance_id}/full-sql-search

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Explanation:

Project ID of a tenant in a region

To obtain this value, see Obtaining a Project ID.

Constraints:

N/A

Values:

The value can contain 32 characters. Only letters and digits are allowed.

Default value:

N/A

instance_id

Yes

String

Explanation:

Unique ID of an instance

Constraints:

N/A

Values:

The value can contain 32 characters. Only letters and digits are allowed.

Default value:

N/A

Table 2 Query parameters

Parameter

Mandatory

Type

Description

start_at

Yes

Long

Explanation:

Start time in the Unix timestamp format, in milliseconds

Constraints:

N/A

Values:

[0, 2^31-1]. The actual value depends on the query result.

Default value:

N/A

end_at

Yes

Long

Explanation:

End time in the Unix timestamp format, in milliseconds

Constraints:

N/A

Values:

[0, 2^31-1]. The actual value depends on the query result.

Default value:

N/A

task_ids

No

Array of long

Explanation:

SQL Insight task IDs. SQL Insight tasks that span more than one day will be split for parsing. Multiple tasks can be filtered and exported at the same time.

Constraints:

Multiple values need to be separated by commas (,).

Values:

[0, 2^31-1]. The actual value depends on the query result.

Default value:

N/A

node_id

No

String

Explanation:

Node ID

Constraints:

N/A

Values:

The value can contain 32 characters. Only letters and digits are allowed.

Default value:

N/A

keyword

No

String

Explanation:

Keyword

Constraints:

Multiple values need to be separated by commas (,).

Values:

N/A

Default value:

N/A

fuzzy

No

String

Explanation:

Whether fuzzy match is used

Constraints:

N/A

Values:

N/A

Default value:

N/A

user_list

No

String

Explanation:

Username

Constraints:

Multiple values need to be separated by commas (,).

Values:

N/A

Default value:

N/A

db_list

No

String

Explanation:

Database

Constraints:

Multiple values need to be separated by commas (,).

Values:

N/A

Default value:

N/A

operation_list

No

String

Explanation:

Operation type

Constraints:

Multiple values need to be separated by commas (,).

Values:

N/A

Default value:

N/A

client_ip_list

No

String

Explanation:

Client IP address

Constraints:

Multiple values need to be separated by commas (,).

Values:

N/A

Default value:

N/A

thread_id_list

No

String

Explanation:

Thread ID

Constraints:

Multiple values need to be separated by commas (,).

Values:

N/A

Default value:

N/A

trx_id_list

No

String

Explanation:

Transaction ID

Constraints:

Multiple values need to be separated by commas (,).

Values:

N/A

Default value:

N/A

session_id_list

No

String

Explanation:

Session ID

Constraints:

Multiple values need to be separated by commas (,).

Values:

N/A

Default value:

N/A

status_list

No

String

Explanation:

Execution status

Constraints:

Multiple values need to be separated by commas (,).

Values:

  • 0: successful
  • 1: failed

Default value:

N/A

sql_template_ids

No

String

Explanation:

SQL template ID

Constraints:

Multiple values need to be separated by commas (,).

Values:

N/A

Default value:

N/A

cost_min

No

Double

Explanation:

Minimum execution duration, in milliseconds

Constraints:

N/A

Values:

N/A

Default value:

N/A

cost_max

No

Double

Explanation:

Maximum execution duration, in milliseconds

Constraints:

N/A

Values:

N/A

Default value:

N/A

scan_min

No

Long

Explanation:

Minimum rows scanned

Constraints:

N/A

Values:

[0, 2^31-1]. The actual value depends on the query result.

Default value:

N/A

scan_max

No

Long

Explanation:

Maximum rows scanned

Constraints:

N/A

Values:

[0, 2^31-1]. The actual value depends on the query result.

Default value:

N/A

affect_min

No

Long

Explanation:

Minimum rows affected

Constraints:

N/A

Values:

[0, 2^31-1]. The actual value depends on the query result.

Default value:

N/A

affect_max

No

Long

Explanation:

Maximum rows affected

Constraints:

N/A

Values:

[0, 2^31-1]. The actual value depends on the query result.

Default value:

N/A

return_min

No

Long

Explanation:

Minimum rows returned

Constraints:

N/A

Values:

[0, 2^31-1]. The actual value depends on the query result.

Default value:

N/A

return_max

No

Long

Explanation:

Maximum rows returned

Constraints:

N/A

Values:

[0, 2^31-1]. The actual value depends on the query result.

Default value:

N/A

sort_field

No

String

Explanation:

Sorting field

Constraints:

N/A

Values:

  • execute_at: execution time
  • execute_cost: execution duration
  • lock_wait_time: lock wait time
  • rows_examined: scanned rows
  • rows_returned: returned rows

Default value:

N/A

asc

No

Boolean

Explanation:

Sorting order

Constraints:

N/A

Values:

  • true: ascending
  • false: descending

Default value:

N/A

page

No

Integer

Explanation:

Page number

Constraints:

N/A

Values:

[0, 2^31-1]. The actual value depends on the query result.

Default value:

N/A

limit

No

Integer

Explanation:

Records on each page

Constraints:

N/A

Values:

[0, 100]. The actual value depends on the query result.

Default value:

N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

full_sql_details

Array of Table 4 objects

Explanation:

Details about all SQL statements

Values:

N/A

total

Integer

Explanation:

Total number

Values:

N/A

Table 4 full_sql_details

Parameter

Type

Description

sql

String

Explanation:

SQL statement

Values:

N/A

sql_template_id

String

Explanation:

SQL template ID

Values:

N/A

operate_type

String

Explanation:

Operation type

Values:

N/A

status

String

Explanation:

Status

Values:

N/A

error_no

String

Explanation:

Error code

Values:

N/A

database

String

Explanation:

Database

Values:

N/A

thread_id

String

Explanation:

Thread ID

Values:

N/A

client

String

Explanation:

Client

Values:

N/A

user

String

Explanation:

User

Values:

N/A

execute_at

Long

Explanation:

Execution start time in the Unix timestamp format, in milliseconds

Values:

N/A

query_time

Double

Explanation:

Execution duration, in milliseconds

Values:

N/A

lock_time

Double

Explanation:

Lock wait time (ms)

Values:

N/A

rows_examined

Long

Explanation:

Number of scanned rows

Values:

N/A

rows_sent

Long

Explanation:

Returned rows

Values:

N/A

rows_affected

Long

Explanation:

Updated rows

Values:

N/A

trx_id

Long

Explanation:

Transaction ID

Values:

N/A

cpu_time

Double

Explanation:

CPU time (μs)

Values:

N/A

send_bytes

Long

Explanation:

Output bytes

Values:

N/A

query_tables

String

Explanation:

All table names in the format of Database name.Table name|Database name.Table name

Values:

N/A

innodb_io_read_bytes

Long

Explanation:

Physical I/O read bytes

Values:

N/A

innodb_io_read

Integer

Explanation:

Physical I/O reads

Values:

N/A

innodb_io_read_wait

Double

Explanation:

Physical I/O wait time, in milliseconds

Values:

N/A

innodb_lock_wait

Double

Explanation:

Row lock wait time, in milliseconds

Values:

N/A

innodb_queue_wait

Double

Explanation:

InnoDB lock wait time, in milliseconds

Values:

N/A

kernel_version

String

Explanation:

Kernel version for DDM instances

Values:

N/A

query_time_detail

String

Explanation:

Time required at each phase during SQL statement execution. This parameter is used by DDM instances.

Values:

N/A

session_id

String

Explanation:

Session ID

Values:

N/A

node_id

String

Explanation:

Node ID

Values:

The value can contain 32 characters. Only letters and digits are allowed.

Example Request

GET https://das.cn-north-1.myhuaweicloud.com/v3/054e292c9880d4992f02c0196d3ea468/instances/da304cd5bbb944de828759bc7be3d3fein01/full-sql-search?start_at=1738733117000&end_at=1738808281000&task_ids=1128

Example Response

Status code: 200

{
  "full_sql_details": [
    {
      "sql": "select sleep(90)",
      "sql_template_id": "AAD913807ECE9C66",
      "operate_type": "select",
      "status": "success",
      "error_no": "",
      "database": "test_db",
      "thread_id": "5866666",
      "client": "100.79.3.154",
      "user": "root",
      "execute_at": 1738808280958,
      "query_time": 90000,
      "lock_time": 0,
      "rows_examined": 0,
      "rows_sent": 1,
      "rows_affected": 0,
      "trx_id": 0,
      "cpu_time": 0,
      "node_id": "fec05693c76c4f389561051db430324cno01"
    }
  ],
  "total": 1036
}

Status Codes

Status Code

Description

200

Details about all SQL statements are exported.

400

Client error

500

Server error

Error Codes

See Error Codes.