GetPfsSqlSummaries

Updated at:

Queries the full request data aggregated by SQL ID in Performance Insight (New Version) for a database instance.

Operation description

You must meet the following prerequisites to use this operation:

  • Use the latest version of the Alibaba Cloud SDK or DAS SDK.

  • When you use an SDK to call DAS, set the region to cn-shanghai.

  • The target database instance is an ApsaraDB RDS for MySQL instance or a PolarDB for MySQL cluster.

  • Performance Insight (New Version) is enabled for the target database instance. For more information, see Performance Insight (New Version).

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

hdm:GetPfsSqlSummaries

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

No

The instance ID.

rm-uf61swc4cru0b****

NodeId

string

No

The node ID.

Note

For an ApsaraDB RDS for MySQL Cluster Edition instance or a PolarDB for MySQL cluster, you must specify the node ID.

r-****-db-0

SqlId

string

No

The SQL ID.

Note

If you specify an SQL ID, the operation queries the full request data for the specified SQL ID. If you leave this parameter empty, the operation queries the full request data for the entire database instance.

651b56fe9418d48edb8fdf0980ec****

Keywords

string

No

The keywords in the SQL text. Separate multiple keywords with spaces.

select update

StartTime

integer

No

The start time of the query. The time is a UNIX timestamp in milliseconds.

1675833788056

EndTime

integer

No

The end time of the query. The time is a UNIX timestamp in milliseconds.

Note

The end time must be later than the start time. You can query data for a maximum of seven days within the last month.

1679297005999

OrderBy

string

No

The field by which to sort the results. Default value: count.

  • count: the number of executions.

  • avgLatency: the average execution time.

  • rowsExamined: the total number of scanned rows.

  • rowsExaminedAvg: the average number of scanned rows.

  • rowsSentAvg: the average number of returned rows.

count

Asc

boolean

No

Specifies whether to sort the results in ascending order. Default value: false.

  • true: yes

  • false: no

false

PageNo

integer

No

The page number for the paging query. Pages start from 1. Default value: 1.

1

PageSize

integer

No

The maximum number of records per page for the paging query. Default value: 10. Maximum value: 100.

10

Response elements

Element

Type

Description

Example

object

ListResult

Message

string

The response message.

Note

If the request is successful, this parameter returns Successful. If the request fails, this parameter returns the exception information, such as the error code.

Successful

RequestId

string

The request ID.

54F3DBAE-9420-511A-9C29-265E8C04****

Data

object

The response data.

Total

integer

The total number of entries.

264

List

array<object>

The list of details.

object

The returned items.

UserId

string

The user ID.

196278346919****

Psql

string

The SQL template.

select ?

InstanceId

string

The instance ID.

rm-2ze8g2am97624****

NodeId

string

The node ID.

Note

This parameter is returned for ApsaraDB RDS for MySQL Cluster Edition or PolarDB for MySQL instances.

r-x****-db-0

SqlType

string

The SQL type. Valid values:

  • SELECT

  • UPDATE

  • DELETE

SELECT

LogicId

integer

The logical database ID.

58275984

SqlId

string

The SQL template ID.

2e8147b5ca2dfc640dfd5e43d96a****

Timestamp

integer

The data date in the UNIX timestamp format. Unit: milliseconds.

1643040000000

RtRate

number

The proportion of the execution duration.

0.1384

CountRate

number

The proportion of executions.

0.0586

FullScan

boolean

Specifies whether a full table scan is performed. Valid values:

  • true: Yes.

  • false: No.

true

Count

integer

The total number of executions.

100000

ErrCount

integer

The number of errors.

0

WarnCount

integer

The number of warnings.

0

TotalLatency

number

The total execution duration. Unit: milliseconds.

60913.256

MaxLatency

number

The maximum execution duration. Unit: milliseconds.

36.233

AvgLatency

number

The average SQL execution duration. Unit: milliseconds.

0.1717

RowsSent

integer

The number of returned rows.

0

RowsSendAvg

number

The average number of sent rows.

0

RowsExamined

integer

The total number of scanned rows.

100

RowsExaminedAvg

number

The average number of scanned rows.

0

RowsAffected

integer

The number of affected rows.

0

RowsAffectedAvg

number

The average number of affected rows.

0

TmpTables

integer

The number of temporary tables.

0

TmpDiskTables

integer

The number of temporary disk tables.

0

RowsSorted

integer

The number of sorted rows.

0

SortMergePasses

integer

The number of merge passes that the sorting algorithm must perform.

0

PhysicalReads

integer

The number of physical nodes.

0

PhysicalAsyncReads

integer

The number of physical asynchronous nodes.

0

SemisyncDelayTime

number

The semi-synchronous delay time. Unit: milliseconds.

0.12

RowsSentAvg

number

The average number of rows returned per SQL statement.

0.52

LogicReads

integer

The number of logical nodes.

0

RedoWrites

integer

The number of redo nodes.

0

DataWriteTime

number

The data write time. Unit: milliseconds.

0

DataWrites

integer

The number of writable data nodes.

0

DataReadTime

number

The readable data timestamp. Unit: milliseconds.

0

DataReads

integer

The number of readable data nodes.

0

RwlockOsWaits

integer

Specifies whether read/write splitting is enabled. Valid values:

  • 0: Disabled.

  • 1: Enabled.

0

RwlockSpinRounds

integer

The read/write splitting parameter.

0

RwlockSpinWaits

integer

Specifies whether multiple index scanning is enabled. Valid values:

  • 0: Disabled.

  • 1: Enabled.

0

MutexWaits

integer

The number of mutex waits.

1

MutexSpins

integer

The number of mutex spins.

1

TransactionLockTime

number

The storage transaction lock time. Unit: milliseconds.

0

ServerLockTime

number

The server lock time. Unit: milliseconds.

0

CpuTime

number

The CPU execution time. Unit: milliseconds.

0

ElapsedTime

number

The actual execution time. Unit: milliseconds.

0

Id

integer

The primary key ID.

26186357

SelectScanAvg

number

The average number of scans.

0

SelectRangeAvg

number

The average selection range.

0

SelectFullJoinAvg

number

The average number of joins that perform table scans without using indexes.

Important If the value of this parameter is not 0, carefully check the indexes of the table.

0

SelectFullRangeJoinAvg

number

The average number of range joins.

0

SortScanAvg

number

The average number of sort scans.

0

SortRowsAvg

number

The average number of sorted rows.

0

TmpTablesAvg

number

The average number of temporary tables.

0

TmpDiskTablesAvg

number

The average number of temporary disk tables.

0

FirstTime

integer

The first execution time in the UNIX timestamp format. Unit: milliseconds.

1659308149000

LastTime

integer

The last modification time in the UNIX timestamp format. Unit: milliseconds.

1661306520000

LockLatencyAvg

number

The average lock wait time. Unit: milliseconds.

0

TimerWaitAvg

number

The reserved parameter.

0

SortRangeAvg

number

The average number of range sorts.

0

CpuRate

number

The ratio of the CPU execution time to the total SQL execution time.

0

Db

string

The database name.

testDB

Tables

array

The database table name.

string

The database table name.

test_table

PageNo

integer

The page number.

1

PageSize

integer

The maximum number of entries per page.

10

Extra

any

The reserved parameter.

None

Code

integer

The response status code.

200

Success

boolean

Indicates whether the request is successful. Valid values:

  • true: The request is successful.

  • false: The request fails.

true

Examples

Success response

JSON format

{
  "Message": "Successful",
  "RequestId": "54F3DBAE-9420-511A-9C29-265E8C04****",
  "Data": {
    "Total": 264,
    "List": [
      {
        "UserId": "196278346919****",
        "Psql": "select ?",
        "InstanceId": "rm-2ze8g2am97624****",
        "NodeId": "r-x****-db-0",
        "SqlType": "SELECT",
        "LogicId": 58275984,
        "SqlId": "2e8147b5ca2dfc640dfd5e43d96a****",
        "Timestamp": 1643040000000,
        "RtRate": 0.1384,
        "CountRate": 0.0586,
        "FullScan": true,
        "Count": 100000,
        "ErrCount": 0,
        "WarnCount": 0,
        "TotalLatency": 60913.256,
        "MaxLatency": 36.233,
        "AvgLatency": 0.1717,
        "RowsSent": 0,
        "RowsSendAvg": 0,
        "RowsExamined": 100,
        "RowsExaminedAvg": 0,
        "RowsAffected": 0,
        "RowsAffectedAvg": 0,
        "TmpTables": 0,
        "TmpDiskTables": 0,
        "RowsSorted": 0,
        "SortMergePasses": 0,
        "PhysicalReads": 0,
        "PhysicalAsyncReads": 0,
        "SemisyncDelayTime": 0.12,
        "RowsSentAvg": 0.52,
        "LogicReads": 0,
        "RedoWrites": 0,
        "DataWriteTime": 0,
        "DataWrites": 0,
        "DataReadTime": 0,
        "DataReads": 0,
        "RwlockOsWaits": 0,
        "RwlockSpinRounds": 0,
        "RwlockSpinWaits": 0,
        "MutexWaits": 1,
        "MutexSpins": 1,
        "TransactionLockTime": 0,
        "ServerLockTime": 0,
        "CpuTime": 0,
        "ElapsedTime": 0,
        "Id": 26186357,
        "SelectScanAvg": 0,
        "SelectRangeAvg": 0,
        "SelectFullJoinAvg": 0,
        "SelectFullRangeJoinAvg": 0,
        "SortScanAvg": 0,
        "SortRowsAvg": 0,
        "TmpTablesAvg": 0,
        "TmpDiskTablesAvg": 0,
        "FirstTime": 1659308149000,
        "LastTime": 1661306520000,
        "LockLatencyAvg": 0,
        "TimerWaitAvg": 0,
        "SortRangeAvg": 0,
        "CpuRate": 0,
        "Db": "testDB",
        "Tables": [
          "test_table"
        ]
      }
    ],
    "PageNo": 1,
    "PageSize": 10,
    "Extra": "None"
  },
  "Code": 200,
  "Success": true
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParams The request parameters are invalid. The request parameters are invalid.
403 NoPermission You are not authorized to do this action. You do not have the permission to perform this operation.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.