All Products
Search
Document Center

PolarDB:DescribeSlowLogRecords

更新時間:Apr 15, 2025

Queries the slow SQL query details of PolarDB-X compute nodes and storage nodes.

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 the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

DescribeSlowLogRecords

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

PageSize

Integer

No

30

The number of entries to return on each page. Default value: 100.

Limit: A maximum of 100 records can be returned at a time.

Page

Integer

No

1

The page number. Default value: 1.

StartTime

String

Yes

2024-10-09T02:26

The beginning of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

EndTime

String

Yes

2024-11-22T02:22Z

The end of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

DBInstanceName

String

Yes

pxc-bjxxxxxxxx

The name of the instance.

DBNodeIds

String

No

pxc-i-mezcj4ejdz

The node ID. You can specify multiple node IDs. Separate multiple node IDs with commas (,). This parameter is required when querying storage nodes.

CharacterType

String

Yes

polarx_cn

The node type.

RegionId

String

Yes

cn-hangzhou

The ID of the region in which the instance is located.

DBName

String

No

testdb

The name of the database.

Response parameters

Parameter

Type

Example

Description

RequestId

String

C458B1E8-1683-3645-B154-6BA32080EEA

The ID of the request.

DBInstanceId

String

pxc-********

The ID of the Instance.

PageNumber

String

1

The page number of the returned page.

PageRecordCount

String

30

The number of entries per page.

TotalCount

String

3

The total number of entries returned.

Items

Array of SQLSlowlog

The slow query logs.

SQLHash

String

c8df07e5d45cd68da8b4771c2016e20b

The unique identifier of the SQL query.

SQLText

String

select * from test

The SQL statements.

QueryStartTime

String

2024-11-22T02:22:22.444Z

The timestamp. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ss.SSSZ format. The time is displayed in UTC.

  • For slow query logs of compute nodes, this parameter indicates the execution start time.

  • For slow query logs of data nodes, this parameter indicates the execution end time.

QueryTime

String

3.000

The time consumed to execute the SQL statement. Unit: seconds.

QueryTimeMS

String

3000.000

The time consumed to execute the SQL statement. Unit: milliseconds.

LockTimeMS

String

1

The lock duration of the query. Unit: milliseconds. This parameter is returned only for data nodes.

ParseRowCounts

String

10

The number of rows scanned by the SQL query. This parameter is returned only for data nodes.

ReturnRowCounts

String

20

The number of rows returned. This parameter is returned only for data nodes.

HostAddress

String

****[****] @ [1XX.XX.XX.XX]

The name and IP address of the client that is connected to the database.

DBName

String

dcdev

The database name.

CNname

String

pxc-i-xxxx

The name of the compute node. This parameter is returned only for compute nodes.

Extension

String

tddl:5.4.19-20240927

The extended field. This parameter is returned only for compute nodes.

Fail

String

0

Indicates whether the execution failed or not. This parameter is returned only for compute nodes.

InsName

String

pxc-xdb-s-xxxx

The instance name. This parameter is returned only for data nodes.

IsBind

String

0

Indicates whether prepare mode is enabled. This parameter is returned only for compute nodes.

WT

String

TP

The workload type. This parameter is returned only for compute nodes.

Params

String

["1"]

The parameters in prepare mode. This parameter is returned only for compute nodes.

Frows

String

1

The number of pulled rows. This parameter is returned only for compute nodes.

Rows

String

1

The number of affected or returned rows. This parameter is returned only for compute nodes.

SCNT

String

1

The number of physical SQL statements This parameter is returned only for compute nodes.

SqlType

String

select

The type of the SQL statement. This parameter is returned only for compute nodes.

TooLong

String

0

Indicates whether the statement is too long. This parameter is returned only for compute nodes.

TraceId

String

17a5c5c840006000

The trace ID. This parameter is returned only for compute nodes.

TransactionPolicy

String

XA

The transaction policy. This parameter is returned only for compute nodes.

TrxId

String

17a5c5c840006000

The transaction ID. This parameter is returned only for compute nodes.

TemplateId

String

af33ffee

The ID of the template. This parameter is returned only for compute nodes.

Examples

Sample requests

http(s)://[Endpoint]/?Action=DescribeSlowLogRecords
&PageSize=30
&Page=1
&StartTime=2024-10-09T02:26
&EndTime=2024-11-22T02:22Z
&DBInstanceName=pxc-bjxxxxxxxx
&DBNodeIds=pxc-i-mezcj4ejdz
&CharacterType=polarx_cn
&RegionId=cn-hangzhou
&DBName=testdb
&<Common request parameters>

Sample success responses

XML format

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

<DescribeSlowLogRecordsResponse>
    <RequestId>C458B1E8-1683-3645-B154-6BA32080EEA</RequestId>
    <DBInstanceId>pxc-********</DBInstanceId>
    <PageNumber>1</PageNumber>
    <PageRecordCount>30</PageRecordCount>
    <TotalCount>3</TotalCount>
    <Items>
        <SQLHash>c8df07e5d45cd68da8b4771c2016e20b</SQLHash>
        <SQLText>select * from test </SQLText>
        <QueryStartTime>2024-11-22T02:22:22.444Z</QueryStartTime>
        <QueryTime>3.000</QueryTime>
        <QueryTimeMS>3000.000</QueryTimeMS>
        <LockTimeMS>1</LockTimeMS>
        <ParseRowCounts>10</ParseRowCounts>
        <ReturnRowCounts>20</ReturnRowCounts>
        <HostAddress>****[****] @ [1XX.XX.XX.XX]
</HostAddress>
        <DBName>dcdev</DBName>
        <CNname>pxc-i-xxxx</CNname>
        <Extension>tddl:5.4.19-20240927</Extension>
        <Fail>0</Fail>
        <InsName>pxc-xdb-s-xxxx</InsName>
        <IsBind>0</IsBind>
        <WT>TP</WT>
        <Params>["1"]</Params>
        <Frows>1</Frows>
        <Rows>1</Rows>
        <SCNT>1</SCNT>
        <SqlType>select</SqlType>
        <TooLong>0</TooLong>
        <TraceId>17a5c5c840006000</TraceId>
        <TransactionPolicy>XA</TransactionPolicy>
        <TrxId>17a5c5c840006000</TrxId>
        <TemplateId>af33ffee</TemplateId>
    </Items>
</DescribeSlowLogRecordsResponse>

JSON format

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

{
  "RequestId" : "C458B1E8-1683-3645-B154-6BA32080EEA",
  "DBInstanceId" : "pxc-********",
  "PageNumber" : "1",
  "PageRecordCount" : "30",
  "TotalCount" : "3",
  "Items" : [ {
    "SQLHash" : "c8df07e5d45cd68da8b4771c2016e20b",
    "SQLText" : "select * from test ",
    "QueryStartTime" : "2024-11-22T02:22:22.444Z",
    "QueryTime" : "3.000",
    "QueryTimeMS" : "3000.000",
    "LockTimeMS" : "1",
    "ParseRowCounts" : "10",
    "ReturnRowCounts" : "20",
    "HostAddress" : "****[****] @ [1XX.XX.XX.XX]\n",
    "DBName" : "dcdev",
    "CNname" : "pxc-i-xxxx",
    "Extension" : "tddl:5.4.19-20240927",
    "Fail" : "0",
    "InsName" : "pxc-xdb-s-xxxx",
    "IsBind" : "0",
    "WT" : "TP",
    "Params" : "[\"1\"]",
    "Frows" : "1",
    "Rows" : "1",
    "SCNT" : "1",
    "SqlType" : "select",
    "TooLong" : "0",
    "TraceId" : "17a5c5c840006000",
    "TransactionPolicy" : "XA",
    "TrxId" : "17a5c5c840006000",
    "TemplateId" : "af33ffee"
  } ]
}

Error codes

HttpCode

Error code

Error message

Description

400

InvalidStartTime.Malformed

The specified parameter StartTime is not valid.

The format of the start time is invalid.

400

InvalidDBInstance.NotFound

The specified DB instance does not exist or is not supported.

The specified instance does not exist.

404

InvalidDBInstanceId.NotFound

The specified DBInstanceId does not exist.

The instance ID does not exist.

For a list of error codes, see Service error codes.