All Products
Search
Document Center

PolarDB:DescribeSlowLogRecords

最終更新日:Oct 11, 2024
This topic is generated by a machine translation engine without any human intervention. ALIBABA CLOUD DOES NOT GUARANTEE THE ACCURACY OF MACHINE TRANSLATED CONTENT. To request a human-translated version of this topic or provide feedback on this translation, please include it in the feedback form.

Slow Log Details

Operation description

Note
  • Only PolarDB MySQL Edition clusters support calling this interface.
  • Starting from September 1, 2024, due to the optimization of the SQL template algorithm, when calling this interface, the value of the SQLHash field will change. For more details, please refer to [Notice] Optimization of Slow SQL Template Algorithm (~~2845725~~).
  • Debugging

    You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

    Authorization information

    The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

    • Operation: the value that you can use in the Action element to specify the operation on a resource.
    • Access level: the access level of each operation. The levels are read, write, and list.
    • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
      • The required resource types are displayed in bold characters.
      • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
    • Condition Key: the condition key that is defined by the cloud service.
    • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
    OperationAccess levelResource typeCondition keyAssociated operation
    polardb:DescribeSlowLogRecordsget
    • dbcluster
      acs:polardb:{#regionId}:{#accountId}:dbcluster/{#dbclusterId}
      none
    none

    Request parameters

    ParameterTypeRequiredDescriptionExample
    RegionIdstringYes

    Region ID.

    Note You can call the DescribeRegions interface to view the available regions under the target account, including the Region ID.
    cn-hangzhou
    DBClusterIdstringYes

    Cluster ID.

    Note You can call the DescribeDBClusters interface to view all cluster information in the target region, including the Cluster ID.
    pc-************
    NodeIdstringNo

    Node ID

    pi-**********
    StartTimestringYes

    Start time of the query. The format is YYYY-MM-DDThh:mmZ (UTC time).

    Note
  • Supports viewing slow log information up to 30 days.
  • The input is UTC time (i.e., 0 timezone). If your service is currently in a different timezone, please perform a time conversion. For example, if the current timezone of your service is Beijing Time (UTC+8) at 12:00, and you need to query the slow logs between 08:00-12:00 Beijing Time, you should input 00:00-04:00.
  • 2022-11-15T16:00Z
    EndTimestringYes

    End time of the query, which must be later than the start time, and the time interval between the start and end times must not exceed 24 hours. The format is YYYY-MM-DDThh:mmZ (UTC time).

    Note The input is UTC time (i.e., 0 timezone). If your service is currently in a different timezone, please perform a time conversion. For example, if the current timezone of your service is Beijing Time (UTC+8) at 12:00, and you need to query the slow logs between 08:00-12:00 Beijing Time, you should input 00:00-04:00.
    2022-11-16T04:00Z
    DBNamestringNo

    Database name.

    testdb
    PageSizeintegerNo

    Number of records per page, with the following options:

    • 30
    • 50
    • 100

    The default value is 30.

    30
    PageNumberintegerNo

    Page number, with a range greater than 0 and not exceeding the maximum value of Integer.

    The default value is 1.

    1
    SQLHASHstringNo

    Unique identifier of the SQL statement in the slow log statistics, which can be used to obtain the detailed slow logs for that SQL statement.

    U2FsdGVk****

    description

    Response parameters

    ParameterTypeDescriptionExample
    object
    DBClusterIdstring

    Cluster ID.

    pc-*****************
    Enginestring

    Database engine.

    polardb_mysql
    Itemsarray<object>

    List of slow log details.

    SQLSlowRecordobject
    DBNamestring

    Database name.

    testdb
    DBNodeIdstring

    Node ID.

    pi-*****************
    ExecutionStartTimestring

    Time when the SQL starts execution. The format is YYYY-MM-DDThh:mmZ (UTC time).

    2021-04-07T03:47Z
    HostAddressstring

    Client address connecting to the database.

    testdb[testdb] @ [100.**.**.242]
    LockTimeslong

    SQL lock duration in seconds.

    0
    ParseRowCountslong

    Number of rows parsed.

    0
    QueryTimeMSlong

    Query time. Unit: milliseconds.

    100
    QueryTimeslong

    SQL execution duration, in seconds.

    20
    ReturnRowCountslong

    Number of rows returned.

    0
    SQLHashstring

    Unique identifier for the SQL statement in slow log statistics.

    U2FsdGVk****
    SQLTextstring

    Query statement.

    /* Query from *** by user 111 */ SELECT sleep(20)
    PageNumberinteger

    Page number.

    1
    PageRecordCountinteger

    Number of records on this page.

    1
    RequestIdstring

    Request ID.

    A7E6A8FD-C50B-46B2-BA85-D8B8D3******
    TotalRecordCountinteger

    Total number of SQL statements.

    1

    description

    Examples

    Sample success responses

    JSONformat

    {
      "DBClusterId": "pc-*****************",
      "Engine": "polardb_mysql",
      "Items": {
        "SQLSlowRecord": [
          {
            "DBName": "testdb",
            "DBNodeId": "pi-*****************",
            "ExecutionStartTime": "2021-04-07T03:47Z",
            "HostAddress": "testdb[testdb] @  [100.**.**.242]",
            "LockTimes": 0,
            "ParseRowCounts": 0,
            "QueryTimeMS": 100,
            "QueryTimes": 20,
            "ReturnRowCounts": 0,
            "SQLHash": "U2FsdGVk****",
            "SQLText": "/* Query from *** by user 111 */ SELECT sleep(20)"
          }
        ]
      },
      "PageNumber": 1,
      "PageRecordCount": 1,
      "RequestId": "A7E6A8FD-C50B-46B2-BA85-D8B8D3******",
      "TotalRecordCount": 1
    }

    Error codes

    HTTP status codeError codeError messageDescription
    400InvalidStartTime.MalformedThe specified parameter StartTime is not valid.The specified StartTime parameter is invalid.
    404InvalidDBClusterId.NotFoundThe DBInstanceId provided does not exist in our records.The specified DBClusterId parameter does not exist in the current record.

    For a list of error codes, visit the Service error codes.

    Change history

    Change timeSummary of changesOperation
    2024-06-19The Error code has changed. The request parameters of the API has changedView Change Details
    2023-06-12The Error code has changedView Change Details