Queries slow query logs by query ID.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeSQLLogByQueryId

The operation that you want to perform. Set the value to DescribeSQLLogByQueryId.

DBInstanceId String Yes gp-****************

The ID of the instance.

Note You can call the DescribeDBInstances operation to query details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.
QueryId String Yes 111111

The query ID.

Note You can call the DescribeSlowSQLLogs operation to query the SQL query ID.

Response parameters

Parameter Type Example Description
RequestId String 07F6177E-****-****-****-0723301340F3

The ID of the request.

Items Array of SQLLog

Details of slow query logs.

OperationClass String DQL

The type of the query language.

ExecuteState String success

The execution state of the query. Valid values:

  • success
  • fail
ExecuteCost Float 1

The execution duration of the query. Unit: seconds.

SQLText String select ** from **

The SQL statement.

SourcePort Integer 50514

The source port number.

DBRole String master

The role of the database.

OperationType String select

The type of the SQL statement.

SourceIP String 192.**.**.121

The source IP address.

SQLPlan String ****

The SQL query plan.

ReturnRowCounts Long 1

The number of entries returned.

DBName String adbpgadmin

The name of the database.

OperationExecuteTime String 2021-03-15T17:02:32Z

The time when the SQL statement was executed.

ScanRowCounts Long 1

The number of entries scanned.

AccountName String testadmin

The database account.

QueryId String 111111

The query ID.

SliceIds Array of String 0,1,2

The slice IDs.


Sample requests

&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK

        <SQLText>select ** from **</SQLText>

JSON format

HTTP/1.1 200 OK

  "RequestId" : "07F6177E-****-****-****-0723301340F3",
  "Items" : [ {
    "OperationClass" : "DQL",
    "ExecuteState" : "success",
    "ExecuteCost" : 1,
    "SQLText" : "select ** from **",
    "SourcePort" : 50514,
    "DBRole" : "master",
    "OperationType" : "select",
    "SourceIP" : "192.**.**.121",
    "SQLPlan" : "****",
    "ReturnRowCounts" : 1,
    "DBName" : "adbpgadmin",
    "OperationExecuteTime" : "2021-03-15T17:02:32Z",
    "ScanRowCounts" : 1,
    "AccountName" : "testadmin",
    "QueryId" : "111111",
    "SliceIds" : [ "0,1,2" ]
  } ]

Error codes

For a list of error codes, visit the API Error Center.