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

Exporting Details About All Query Logs

Function

  • After Collect All Query Logs is enabled, you can create a SQL Insights 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

    Dependencies

    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

Definition

Project ID of a tenant in a region

To obtain this value, see Obtaining a Project ID.

Constraints

N/A

Range

The value can contain 32 characters, including only letters and digits.

Default Value

N/A

instance_id

Yes

String

Definition

Unique ID of an instance

Constraints

N/A

Range

The value can contain 32 characters, including only letters and digits.

Default Value

N/A

Table 2 Query parameters

Parameter

Mandatory

Type

Description

start_at

Yes

Long

Definition

Start time in the Unix timestamp format, in milliseconds

Constraints

N/A

Range

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

Default Value

N/A

end_at

Yes

Long

Definition

End time in the Unix timestamp format, in milliseconds

Constraints

N/A

Range

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

Default Value

N/A

task_ids

No

Array of long

Definition

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 (,).

Range

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

Default Value

N/A

node_id

No

String

Definition

Node ID

Constraints

N/A

Range

The value can contain 32 characters, including only letters and digits.

Default Value

N/A

keyword

No

String

Definition

Keyword

Constraints

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

Range

N/A

Default Value

N/A

fuzzy

No

String

Definition

Whether fuzzy match is used

Constraints

N/A

Range

N/A

Default Value

N/A

user_list

No

String

Definition

Username

Constraints

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

Range

N/A

Default Value

N/A

db_list

No

String

Definition

Database

Constraints

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

Range

N/A

Default Value

N/A

operation_list

No

String

Definition

Operation type

Constraints

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

Range

  • insert
  • delete
  • update
  • select
  • show
  • create
  • drop
  • alter
  • set
  • replace
  • use
  • start: Start a transaction.
  • commit: Commit a transaction.
  • rollback: Roll back a transaction.
  • truncate
  • begin: Start a transaction.
  • call: Call a stored procedure.

Default Value

N/A

client_ip_list

No

String

Definition

Client IP address

Constraints

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

Range

N/A

Default Value

N/A

thread_id_list

No

String

Definition

Thread ID

Constraints

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

Range

N/A

Default Value

N/A

trx_id_list

No

String

Definition

Transaction ID

Constraints

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

Range

N/A

Default Value

N/A

session_id_list

No

String

Definition

Session ID

Constraints

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

Range

N/A

Default Value

N/A

status_list

No

String

Definition

Execution status

Constraints

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

Range

  • 0: successful
  • 1: failed

Default Value

N/A

sql_template_ids

No

String

Definition

SQL template ID

Constraints

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

Range

N/A

Default Value

N/A

cost_min

No

Double

Definition

Minimum execution duration, in milliseconds

Constraints

N/A

Range

N/A

Default Value

N/A

cost_max

No

Double

Definition

Maximum execution duration, in milliseconds

Constraints

N/A

Range

N/A

Default Value

N/A

scan_min

No

Long

Definition

Minimum rows scanned

Constraints

N/A

Range

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

Default Value

N/A

scan_max

No

Long

Definition

Maximum rows scanned

Constraints

N/A

Range

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

Default Value

N/A

affect_min

No

Long

Definition

Minimum rows affected

Constraints

N/A

Range

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

Default Value

N/A

affect_max

No

Long

Definition

Maximum rows affected

Constraints

N/A

Range

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

Default Value

N/A

return_min

No

Long

Definition

Minimum rows returned

Constraints

N/A

Range

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

Default Value

N/A

return_max

No

Long

Definition

Maximum rows returned

Constraints

N/A

Range

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

Default Value

N/A

sort_field

No

String

Definition

Sorting field

Constraints

N/A

Range

  • 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

Definition

Sorting order

Constraints

N/A

Range

  • true: ascending
  • false: descending

Default Value

N/A

page

No

Integer

Definition

Page number

Constraints

N/A

Range

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

Default Value

N/A

limit

No

Integer

Definition

Records on each page

Constraints

N/A

Range

[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

Definition

Details about all SQL statements

Range

N/A

total

Integer

Definition

Total number

Range

N/A

Table 4 full_sql_details

Parameter

Type

Description

sql

String

Definition

SQL statement

Range

N/A

sql_template_id

String

Definition

SQL template ID

Range

N/A

operate_type

String

Definition

Operation type

Range

  • insert
  • delete
  • update
  • select
  • show
  • create
  • drop
  • alter
  • set
  • replace
  • use
  • start: Start a transaction.
  • commit: Commit a transaction.
  • rollback: Roll back a transaction.
  • truncate
  • begin: Start a transaction.
  • call: Call a stored procedure.

status

String

Definition

Status

Range

  • 0: The SQL statement is successfully executed.
  • 1: The SQL statement failed to be executed.

error_no

String

Definition

Error code

Range

N/A

database

String

Definition

Database

Range

N/A

thread_id

String

Definition

Thread ID

Range

N/A

client

String

Definition

Client

Range

N/A

user

String

Definition

User

Range

N/A

execute_at

Long

Definition

Execution start time in the Unix timestamp format, in milliseconds

Range

N/A

query_time

Double

Definition

Execution duration, in milliseconds

Range

N/A

lock_time

Double

Definition

Lock wait time (ms)

Range

N/A

rows_examined

Long

Definition

Number of scanned rows

Range

N/A

rows_sent

Long

Definition

Returned rows

Range

N/A

rows_affected

Long

Definition

Updated rows

Range

N/A

trx_id

Long

Definition

Transaction ID

Range

N/A

cpu_time

Double

Definition

CPU time (μs)

Range

N/A

send_bytes

Long

Definition

Output bytes

Range

N/A

query_tables

String

Definition

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

Range

N/A

innodb_io_read_bytes

Long

Definition

Physical I/O read bytes

Range

N/A

innodb_io_read

Integer

Definition

Physical I/O reads

Range

N/A

innodb_io_read_wait

Double

Definition

Physical I/O wait time, in milliseconds

Range

N/A

innodb_lock_wait

Double

Definition

Row lock wait time, in milliseconds

Range

N/A

innodb_queue_wait

Double

Definition

InnoDB lock wait time, in milliseconds

Range

N/A

kernel_version

String

Definition

Kernel version for DDM instances

Range

N/A

query_time_detail

String

Definition

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

Range

N/A

session_id

String

Definition

Session ID

Range

N/A

node_id

String

Definition

Node ID

Range

The value can contain 32 characters, including only letters and digits.

Example Requests

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 Responses

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.