Queries slow query logs by query ID.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates a 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 about 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 about slow query logs.

OperationClass String DQL

The query language.

ExecuteState String success

The execution state of the query.

ExecuteCost Float 1

The execution duration of the query.

SQLText String select ** from **

The SQL statement.

SourcePort Integer 50514

The source port number.

DBRole String master

The database role.

OperationType String select

The query type.

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.

Examples

Sample requests

http(s)://gpdb.aliyuncs.com/?Action=DescribeSQLLogByQueryId
&DBInstanceId=gp-****************
&QueryId=111111
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeSQLLogByQueryIdResponse>
    <RequestId>07F6177E-****-****-****-0723301340F3</RequestId>
    <Items>
        <OperationClass>DQL</OperationClass>
        <ExecuteState>success</ExecuteState>
        <ExecuteCost>1</ExecuteCost>
        <SQLText>select ** from **</SQLText>
        <SourcePort>50514</SourcePort>
        <DBRole>master</DBRole>
        <OperationType>select</OperationType>
        <SourceIP>192.**.**.121</SourceIP>
        <SQLPlan>****</SQLPlan>
        <ReturnRowCounts>1</ReturnRowCounts>
        <DBName>adbpgadmin</DBName>
        <OperationExecuteTime>2021-03-15T17:02:32Z</OperationExecuteTime>
        <ScanRowCounts>1</ScanRowCounts>
        <AccountName>testadmin</AccountName>
        <QueryId>111111</QueryId>
    </Items>
</DescribeSQLLogByQueryIdResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "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"
  } ]
}

Error codes

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