Help Center/ Data Admin Service/ API Reference/ APIs/ Intelligent O&M/ Searching for SQL Statements Using Multiple Conditions
Updated on 2026-08-25 GMT+08:00

Searching for SQL Statements Using Multiple Conditions

Function

This API is used to search for SQL statements using multiple conditions.

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:fullSqlList

    Read

    Instance

    -

    -

    -

URI

GET /v3/{project_id}/fullsql/search

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region.

To obtain the value, see Obtaining a Project ID.

Constraints

N/A

Range

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

Default Value

N/A

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

instance_id

Yes

String

Definition

Unique ID of an instance

Constraints

N/A

Range

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

Default Value

N/A

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_id

No

long

Definition

SQL Insights task ID. Either this parameter or task_ids must be specified.

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 Insights task ID list. SQL Insights tasks that span more than one day will be split for parsing. Either this parameter or task_id must be specified.

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. Only letters and digits are supported.

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

N/A

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

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

page_size

No

Integer

Definition

Number of records on each page

Constraints

N/A

Range

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

Default Value

N/A

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

sql_item_dto_list

Array of objects in Table 4

Definition

SQL list

Range

N/A

total

Long

Definition

Total number

Range

A maximum of 100,000 rows are supported.

Table 4 SQL list

Parameter

Type

Description

id

String

Definition

SQL 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.

sql_template_id

String

Definition

Template ID

Range

N/A

sql

String

Definition

SQL text

Range

N/A

database

String

Definition

Database name

Range

N/A

thread_id

String

Definition

Thread ID

Range

N/A

username

String

Definition

Username

Range

N/A

client_ip

String

Definition

Client IP address

Range

N/A

status

Integer

Definition

Execution status

Range

N/A

execute_cost

Double

Definition

Execution duration (ms)

Range

N/A

execute_at

Double

Definition

Execution time (ms)

Range

N/A

rows_affected

Integer

Definition

Updated rows

Range

N/A

rows_examined

Integer

Definition

Number of scanned rows

Range

N/A

lock_wait_time

Double

Definition

Lock wait time

Range

N/A

rows_returned

Integer

Definition

Returned rows

Range

N/A

trx_id

Long

Definition

Transaction ID

Range

N/A

cpu_time

String

Definition

CPU time

Range

N/A

send_bytes

Long

Definition

Sent 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

Number of physical I/O read bytes

Range

N/A

innodb_io_read

Integer

Definition

Number of physical I/O reads

Range

N/A

innodb_io_read_wait

Double

Definition

Physical I/O read wait time (ms)

Range

N/A

innodb_lock_wait

Double

Definition

Row lock wait time (ms)

Range

N/A

innodb_queue_wait

Double

Definition

InnoDB lock wait time (ms)

Range

N/A

kernel_version

String

Definition

Kernel version used by DDM

Range

N/A

query_time_detail

String

Definition

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

Range

N/A

session_id

String

Definition

Session ID

Range

N/A

error_no

Integer

Definition

Error code

Range

N/A

node_id

String

Definition

Node ID

Range

N/A

logical_reads

Long

Definition

SQL Server: logical I/O read

Range

N/A

physical_reads

Long

Definition

SQL Server: physical I/O read

Range

N/A

writes

Long

Definition

SQL Server: I/O write

Range

N/A

app_name

String

Definition

SQL Server: application name

Range

N/A

Example Requests

POST https://das.cn-north-1.myhuaweicloud.com/v3/054e292c9880d4992f02c0196d3ea468/fullsql/search?instance_id=bcfa975193f1402fa11a6d4fd6baf5fbin01&page_no=1&page_size=20&sort_field=&asc=&start_at=1763531906000&end_at=1763618306000&fuzzy=false&task_id=1620

Example Responses

Status code: 200

Success.

{
    "total": 1,
    "sql_item_dto_list": [
        {
            "operate_type": "select",
            "sql_template_id": "199E7DCA63EA8858",
            "instance_id": "bcfa975193f1402fa11a6d4fd6baf5fbin01",
            "sql": "SELECT 1",
            "database": "",
            "thread_id": 27694776,
            "username": "root",
            "client_ip": "100.79.0.247",
            "status": 0,
            "execute_cost": 0,
            "execute_at": 1763614186833,
            "rows_affected": 0,
            "rows_examined": 0,
            "lock_wait_time": 0,
            "rows_returned": 1,
            "trx_id": 0,
            "cpu_time": 0,
            "session_id": "27694776",
            "error_no": 0,
            "node_id": "7c1efa30d2a340b68bc0a80652e14179no01"
        }
    ]
}

Status Codes

Status Code

Description

200

Success.

400

Client error.

500

Server error.

Error Codes

See Error Codes.