Updated on 2025-12-26 GMT+08:00

Exporting Slow SQL Statements

Function

This API is used to export slow SQL statements. Before calling this API:

Constraints

This API is only available for nodes with CNs or DNs (primary or standby DNs) deployed.

Debugging

You can debug this API in API Explorer.

URI

POST /v3/{project_id}/instances/{instance_id}/slow-sql-list/export
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

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

Default Value

N/A

instance_id

Yes

Definition

Instance ID, which uniquely identifies an instance.

Constraints

N/A

Range

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

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token.

You can obtain the token by calling the IAM API used to obtain a user token.

After a response is returned, the value of X-Subject-Token in the response header is the token.

Constraints

N/A

Range

N/A

Default Value

N/A

X-Language

No

String

Definition

Language.

Constraints

N/A

Range

  • zh-cn
  • en-us

Default Value

en-us

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

start_time

Yes

Long

Definition

Start date.

Constraints

The value is a 13-digit UNIX timestamp, in milliseconds. The time zone is UTC.

Range

N/A

Default Value

N/A

end_time

Yes

Long

Definition

End date.

Constraints

The value is a 13-digit UNIX timestamp, in milliseconds. The time zone is UTC.

Range

N/A

Default Value

N/A

instance_id

Yes

String

Definition

Instance ID.

Constraints

N/A

Range

N/A

Default Value

N/A

threshold

Yes

Integer

Definition

Slow SQL threshold, in seconds.

Constraints

N/A

Range

1–99

Default Value

N/A

node_ids

Yes

Array of strings

Definition

Node ID.

Constraints

The value cannot be left blank.

sql_id

No

String

Definition

ID of a slow SQL statement. You can filter slow SQL statements by SQL ID.

Constraints

N/A

Range

N/A

Default Value

N/A

multi_queries

No

Array of objects

Definition

Query conditions for field aggregation.

For details, see Table 4.

Constraints

Only all-AND or all-OR queries can be performed on the query field.

Table 4 MultiMergeCondition

Parameter

Mandatory

Type

Description

name

Yes

String

Definition

Name of the field to be queried.

Constraints

Only the character string query is supported.

Range

1 to 128 characters, including letters (case-sensitive), digits, and underscores (_)

Default Value

N/A

condition

Yes

String

Definition

Combination condition.

Constraints

N/A

Range

The value can only be and, or, AND or OR.

Default Value

N/A

values

Yes

Array of strings

Definition

Set of multiple search criteria. The value is a list of 1 to 5 characters.

Constraints

N/A

is_fuzzy

No

Boolean

Definition

Set of multiple search criteria.

Constraints

The value can only be true for fuzzy query.

Range

  • true: fuzzy search
  • false: exact match

Default Value

true

Response Parameters

None

Example Request

POST https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0611f1bd8b00d5d32f17c017f15b599f/instances/3d39c18788b54a919bab633874c159dfin14/slow-sql-list/export
{ 
  "instance_id" : "d04686c6baae4f65a742771186f47b7ain14", 
  "node_ids" : [ "88391813e1cb4e93899b210e880fdb1bno20" ], 
  "start_time" : 1686903754933, 
  "end_time" : 1686990154933, 
  "threshold" : 1,
  "multi_queries": [ { "name": "query", "condition": "AND", "is_fuzzy": true, "values": [ "slelect", "from table" ] } ]
}

Example Response

None

Status Codes

Error Codes

For details, see Error Codes.