全部產品
Search
文件中心

Database Autonomy Service:GetPfsSqlSummaries - 查詢按照SQL ID維度統計的全量請求資料

更新時間:Mar 20, 2026

調用GetPfsSqlSummaries介面,查詢資料庫執行個體效能洞察(新版)中按照SQL ID維度全量請求資料。

介面說明

使用該介面需滿足以下前提條件:

  • 使用阿里雲或 DAS 的 SDK 時,建議使用最新版本。

  • 在使用 SDK 調用 DAS 服務時,需要將地區指定為 cn-shanghai。

  • 目標資料庫執行個體為 RDS MySQL 或 PolarDB MySQL 版。

  • 目標資料庫執行個體已開啟效能洞察(新版),詳情請參見效能洞察(新版)

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

hdm:GetPfsSqlSummaries

get

*全部資源

*

請求參數

名稱

類型

必填

描述

樣本值

InstanceId

string

執行個體 ID。

rm-uf61swc4cru0b****

NodeId

string

節點 ID。

說明

對於 RDS MySQL 叢集系列或 PolarDB MySQL 版資料庫執行個體,需要提供節點 ID。

r-****-db-0

SqlId

string

SQL ID。

說明

傳入 SQL ID 時,統計目標 SQL ID 的全量請求資料;為空白時,統計整個資料庫執行個體的全量請求資料。

651b56fe9418d48edb8fdf0980ec****

Keywords

string

SQL 文本關鍵詞,多個關鍵詞以空格分隔。

select update

StartTime

integer

查詢開始時間,格式為 Unix 時間戳記,單位為毫秒。

1675833788056

EndTime

integer

查詢結束時間,格式為 Unix 時間戳記,單位為毫秒。

說明

查詢結束時間需晚於查詢開始時間,最多可查看最近一個月內任意七天的資料。

1679297005999

OrderBy

string

排序欄位,預設為 count

  • count:執行次數。

  • avgLatency:平均執行時間。

  • rowsExamined:總掃描行數。

  • rowsExaminedAvg:平均掃描行數。

  • rowsSentAvg:平均返回行數。

count

Asc

boolean

是否升序排序,預設為 false

  • true:是。

  • false:否。

false

PageNo

integer

分頁查詢的頁碼,從 1 開始,預設為 1。

1

PageSize

integer

分頁查詢每頁最大記錄數,預設為 10,最大為 100。

10

返回參數

名稱

類型

描述

樣本值

object

ListResult

Message

string

請求返回訊息。

說明

請求成功時該參數返回 Successful,請求失敗時會返回請求異常資訊(如錯誤碼等)。

Successful

RequestId

string

請求 ID。

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

Data

object

返回資料。

Total

integer

總資料量。

264

List

array<object>

詳細資料列表。

object

返回資訊列表。

UserId

string

使用者識別碼。

196278346919****

Psql

string

SQL 模板。

select ?

InstanceId

string

執行個體 ID。

rm-2ze8g2am97624****

NodeId

string

節點 ID。

說明

對於 RDS MySQL 叢集系列或 PolarDB MySQL 版資料庫執行個體,返回此參數。

r-x****-db-0

SqlType

string

SQL 的類型。取值:

  • SELECT

  • UPDATE

  • DELETE

SELECT

LogicId

integer

邏輯庫 ID。

58275984

SqlId

string

SQL 模板 ID。

2e8147b5ca2dfc640dfd5e43d96a****

Timestamp

integer

資料日期,格式為 Unix 時間戳記,單位為毫秒。

1643040000000

RtRate

number

耗時佔比。

0.1384

CountRate

number

執行次數佔比。

0.0586

FullScan

boolean

是否全表掃描。取值:

  • true:是。

  • false:否。

true

Count

integer

總執行次數。

100000

ErrCount

integer

錯誤次數。

0

WarnCount

integer

警告次數。

0

TotalLatency

number

總執行耗時,單位毫秒。

60913.256

MaxLatency

number

最大執行耗時,單位毫秒。

36.233

AvgLatency

number

SQL 平均執行耗時,單位毫秒。

0.1717

RowsSent

integer

返回行數。

0

RowsSendAvg

number

平均發送行數。

0

RowsExamined

integer

總掃描行數。

100

RowsExaminedAvg

number

平均掃描行數。

0

RowsAffected

integer

影響行數。

0

RowsAffectedAvg

number

平均影響行數。

0

TmpTables

integer

暫存資料表數量。

0

TmpDiskTables

integer

臨時磁碟表數量。

0

RowsSorted

integer

排序行數。

0

SortMergePasses

integer

排序演算法必須執行的合并次數。

0

PhysicalReads

integer

物理節點數量。

0

PhysicalAsyncReads

integer

物理非同步節點數量。

0

SemisyncDelayTime

number

半同步延遲時間,單位毫秒。

0.12

RowsSentAvg

number

返回 SQL 句的平均行數。

0.52

LogicReads

integer

邏輯節點數。

0

RedoWrites

integer

重做節點數。

0

DataWriteTime

number

資料寫入時間,單位毫秒。

0

DataWrites

integer

可寫資料節點數量。

0

DataReadTime

number

可讀資料時間,單位毫秒。

0

DataReads

integer

可讀資料節點數量。

0

RwlockOsWaits

integer

是否開啟了讀寫分離。取值:

  • 0:未開啟。

  • 1:開啟。

0

RwlockSpinRounds

integer

讀寫分離參數。

0

RwlockSpinWaits

integer

是否開啟多重索引掃描。取值:

  • 0:未開啟。

  • 1:開啟。

0

MutexWaits

integer

互斥等待次數。

1

MutexSpins

integer

互斥旋轉次數。

1

TransactionLockTime

number

儲存事務鎖定時間,單位毫秒。

0

ServerLockTime

number

伺服器鎖定時間,單位毫秒。

0

CpuTime

number

CPU 已耗用時間,單位為毫秒。

0

ElapsedTime

number

實際已耗用時間,單位毫秒。

0

Id

integer

主鍵 ID。

26186357

SelectScanAvg

number

平均掃描數。

0

SelectRangeAvg

number

平均選取範圍。

0

SelectFullJoinAvg

number

不使用索引而執行表掃描的平均串連數。

重要 如果該參數值不為 0,則應仔細檢查表的索引。

0

SelectFullRangeJoinAvg

number

平均範圍串連數。

0

SortScanAvg

number

平均掃描排序數。

0

SortRowsAvg

number

平均排序行數。

0

TmpTablesAvg

number

暫存資料表平均數。

0

TmpDiskTablesAvg

number

臨時磁碟表平均數。

0

FirstTime

integer

首次執行時間,格式為 unix 時間戳記,單位為毫秒。

1659308149000

LastTime

integer

最後變更時間,格式為 unix 時間戳記,單位為毫秒。

1661306520000

LockLatencyAvg

number

平均鎖等待時間,單位毫秒。

0

TimerWaitAvg

number

備用參數。

None

SortRangeAvg

number

使用範圍排序平均次數。

0

CpuRate

number

CPU 執行時間與 SQL 總執行時間的比值。

0

Db

string

資料庫名稱。

testDB

Tables

array

資料庫表名。

string

資料庫表名。

test_table

PageNo

integer

頁碼。

1

PageSize

integer

每頁最大記錄數。

10

Extra

any

備用參數。

None

Code

integer

返回狀態代碼。

200

Success

boolean

請求是否執行成功:

  • true:執行成功。

  • false:執行失敗。

true

樣本

正常返回樣本

JSON格式

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

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 InvalidParams The request parameters are invalid. 請求參數錯誤
403 NoPermission You are not authorized to do this action. 沒有許可權執行該操作

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情