All Products
Search
Document Center

AnalyticDB:DescribeSQLPatterns

Last Updated:Jun 11, 2026

Memanggil API `DescribeSQLPatterns` untuk mengambil pola SQL untuk kluster Database Analitik for MySQL dalam rentang tanggal tertentu.

Deskripsi operasi

  • Global public endpoint: adb.aliyuncs.com.

  • Regional public endpoint: adb.<region-id>.aliyuncs.com. For example: adb.cn-hangzhou.aliyuncs.com.

  • Regional VPC endpoint: adb-vpc.<region-id>.aliyuncs.com. For example: adb-vpc.cn-hangzhou.aliyuncs.com.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tabel berikut menjelaskan otorisasi yang diperlukan untuk memanggil API ini. Anda dapat menentukannya dalam kebijakan Resource Access Management (RAM). Kolom pada tabel dijelaskan sebagai berikut:

  • Action: Aksi yang dapat digunakan dalam elemen Action pada pernyataan kebijakan izin RAM untuk memberikan izin guna melakukan operasi tersebut.

  • API: API yang dapat Anda panggil untuk melakukan aksi tersebut.

  • Access level: Tingkat akses yang telah ditentukan untuk setiap API. Nilai yang valid: create, list, get, update, dan delete.

  • Resource type: Jenis resource yang mendukung otorisasi untuk melakukan aksi tersebut. Ini menunjukkan apakah aksi tersebut mendukung izin tingkat resource. Resource yang ditentukan harus kompatibel dengan aksi tersebut. Jika tidak, kebijakan tersebut tidak akan berlaku.

    • Untuk API dengan izin tingkat resource, jenis resource yang diperlukan ditandai dengan tanda bintang (*). Tentukan Nama Sumber Daya Alibaba Cloud (ARN) yang sesuai dalam elemen Resource pada kebijakan.

    • Untuk API tanpa izin tingkat resource, ditampilkan sebagai All Resources. Gunakan tanda bintang (*) dalam elemen Resource pada kebijakan.

  • Condition key: Kunci kondisi yang didefinisikan oleh layanan. Kunci ini memungkinkan kontrol granular, berlaku baik hanya untuk aksi maupun untuk aksi yang terkait dengan resource tertentu. Selain kunci kondisi spesifik layanan, Alibaba Cloud menyediakan serangkaian common condition keys yang berlaku di semua layanan yang didukung RAM.

  • Dependent action: Aksi dependen yang diperlukan untuk menjalankan aksi tersebut. Untuk menyelesaikan aksi tersebut, pengguna RAM atau role RAM harus memiliki izin untuk melakukan semua aksi dependen.

Action

Access level

Resource type

Condition key

Dependent action

adb:DescribeSQLPatterns

list

DBCluster

acs:adb:{#regionId}:{#accountId}:dbcluster/{#DBClusterId}

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

DBClusterId

string

Yes

ID kluster.

Catatan

Anda dapat memanggil operasi DescribeDBClusters untuk mengkueri detail, termasuk ID kluster, untuk semua kluster Database Analitik for MySQL di wilayah tertentu.

am-bp1r053byu48p****

StartTime

string

Yes

Awal rentang pengatur waktu yang akan dikueri. Tentukan pengatur waktu dalam format yyyy-MM-ddTHH:mm:ssZ. Pengatur waktu harus dalam UTC.

Catatan
  • Anda hanya dapat mengkueri data untuk 14 hari terakhir. Misalnya, jika pengatur waktu saat ini adalah 2021-11-22T12:00:00Z, pengatur waktu paling awal yang dapat Anda kueri adalah 2021-11-09T12:00:00Z.

  • Interval antara pengatur waktu mulai dan pengatur waktu akhir tidak boleh melebihi 24 jam.

2021-09-30T00:10:00Z

EndTime

string

Yes

Akhir rentang pengatur waktu yang akan dikueri. Tentukan pengatur waktu dalam format yyyy-MM-ddTHH:mm:ssZ. Pengatur waktu harus dalam UTC.

Catatan

Pengatur waktu akhir harus lebih lambat daripada pengatur waktu mulai.

2021-09-30T00:15:00Z

RegionId

string

Yes

ID wilayah.

Catatan

Anda dapat memanggil operasi DescribeRegions untuk mengkueri wilayah dan zona ketersediaan yang tersedia untuk Database Analitik for MySQL, termasuk ID wilayah.

cn-hangzhou

Keyword

string

No

Kata kunci untuk memfilter pola SQL.

SELECT

Order

string

Yes

Menentukan cara mengurutkan hasil kueri. Atur parameter ini ke string JSON. Contoh: [{"Field":"AverageQueryTime","Type":"Asc"}]. String JSON berisi bidang berikut:

  • Field: Bidang pengurutan. Nilai valid:

    • PatternCreationTime: pengatur waktu pengiriman paling awal dari pola SQL dalam pengatur waktu tertentu.

    • AverageQueryTime: pengatur waktu kueri total rata-rata dari pola SQL dalam pengatur waktu tertentu.

    • MaxQueryTime: pengatur waktu kueri total maksimum dari pola SQL dalam pengatur waktu tertentu.

    • AverageExecutionTime: pengatur waktu eksekusi rata-rata dari pola SQL dalam pengatur waktu tertentu.

    • MaxExecutionTime: pengatur waktu eksekusi maksimum dari pola SQL dalam pengatur waktu tertentu.

    • AveragePeakMemory: penggunaan memori puncak rata-rata dari pola SQL dalam pengatur waktu tertentu.

    • MaxPeakMemory: penggunaan memori puncak maksimum dari pola SQL dalam pengatur waktu tertentu.

    • AverageScanSize: jumlah data Pemindaian rata-rata oleh pola SQL dalam pengatur waktu tertentu.

    • MaxScanSize: jumlah data Pemindaian maksimum oleh pola SQL dalam pengatur waktu tertentu.

    • QueryCount: jumlah eksekusi pola SQL dalam pengatur waktu tertentu.

    • FailedCount: jumlah eksekusi yang gagal untuk pola SQL dalam pengatur waktu tertentu.

  • Type: Pesanan pengurutan. Nilai valid (tidak peka huruf besar/kecil):

    • Asc: Pesanan menaik.

    • Desc: Pesanan menurun.

[{"Field":"AverageQueryTime","Type":"Asc"}]

PageNumber

integer

No

Nomor halaman. Nilai harus berupa bilangan bulat yang lebih besar dari 0.

Catatan

Nilai default adalah 1.

1

PageSize

integer

No

Jumlah entri per halaman. Nilai valid:

  • 30

  • 50

  • 100

Catatan

Nilai default adalah 30.

30

Lang

string

No

Bahasa tanggapan. Parameter ini digunakan untuk melokalkan pesan seperti detail error. Nilai valid:

  • zh: Bahasa Mandarin Sederhana (default)

  • en: Bahasa Inggris

  • ja: Bahasa Jepang

  • zh-tw: Bahasa Mandarin Tradisional.

zh

UserName

string

No

Nama pengguna yang digunakan untuk memfilter pola SQL. Jika Anda menentukan parameter ini, hanya pola SQL dari pengguna yang ditentukan yang akan dikembalikan.

test_user

SqlPatternHash

integer

No

Elemen respons

Element

Type

Description

Example

object

The data returned for the request.

PageNumber

integer

The page number.

1

PageSize

integer

The number of entries returned per page.

30

TotalCount

integer

The total number of entries returned.

1

PatternDetails

array<object>

The details of the SQL patterns.

object

The details of an SQL pattern.

SQLPattern

string

The SQL pattern statement.

SELECT * FROM KEPLER_META_NODE_STATIC_INFO WHERE elastic_node = ? OR (elastic_node = ? AND enable = ?)

PatternId

string

The ID of the SQL pattern.

5575924945138******

User

string

The database username that submitted the SQL statements matching this pattern.

reporter

AccessIp

string

The client IP address from which the SQL statements matching this pattern were submitted.

192.168.xx.xx

Tables

string

The database table scanned by the queries in this pattern.

tpch.orders

PatternCreationTime

string

The earliest time a query matching this pattern was submitted within the specified time range. The time is in the YYYY-MM-DD HH:MM:SS format.

2021-11-12 03:06:00

AverageQueryTime

number

The average query time for statements matching this SQL pattern within the specified time range, in milliseconds.

4

MaxQueryTime

integer

The maximum query time for statements matching this SQL pattern within the specified time range, in milliseconds.

2341

AverageExecutionTime

number

The average execution time for statements matching this SQL pattern within the specified time range, in milliseconds.

234.78

MaxExecutionTime

integer

The maximum execution time for statements matching this SQL pattern within the specified time range, in milliseconds.

2142

AveragePeakMemory

number

The average peak memory usage for statements matching this SQL pattern within the specified time range, in bytes.

234.22

MaxPeakMemory

integer

The maximum peak memory usage for statements matching this SQL pattern within the specified time range, in bytes.

234149

AverageScanSize

number

The average data scan size for statements matching this SQL pattern within the specified time range, in bytes.

234149.23

MaxScanSize

integer

The maximum data scan size for statements matching this SQL pattern within the specified time range, in bytes.

234149

QueryCount

integer

The number of executions for statements matching this pattern within the specified time range.

345

FailedCount

integer

The number of failed executions for statements matching this pattern within the specified time range.

234

Blockable

boolean

Specifies whether queries matching this pattern can be blocked. Valid values:

  • true: The SQL pattern can be blocked.

  • false: The SQL pattern cannot be blocked.

Catatan

AnalyticDB for MySQL supports blocking for only SELECT and INSERT statements.

true

QueryTimeSum

number

The total query time for statements matching this pattern, in milliseconds.

5

QueryTimePercentage

number

The percentage of total query time from all patterns that the queries for this pattern consume.

10

PeakMemorySum

number

The total peak memory used by statements matching this pattern, in bytes.

5

PeakMemoryPercentage

number

The percentage of total peak memory usage from all patterns that the queries for this pattern consume.

10

ScanSizeSum

number

The total data scan size for statements matching this pattern, in bytes.

5

ScanSizePercentage

number

The percentage of the total data scan size from all patterns that the queries for this pattern consume.

80

AverageOperatorCost

number

The average CPU cost for statements matching this pattern, in milliseconds.

5

MaxOperatorCost

number

The maximum CPU cost for statements matching this pattern, in milliseconds.

5

OperatorCostSum

number

The total CPU cost for statements matching this pattern, in milliseconds.

5

OperatorCostPercentage

number

The percentage of the total CPU cost from all patterns that the queries for this pattern consume.

20

AverageScanCost

number

The average CPU cost of table scans for statements matching this pattern, in milliseconds.

5

MaxScanCost

number

The maximum CPU cost of table scans for statements matching this pattern, in milliseconds.

5

ScanCostSum

number

The total CPU cost of table scans for statements matching this pattern, in milliseconds.

5

ScanCostPercentage

number

The percentage of the total CPU cost from all table scans that the queries for this pattern consume.

5

RequestId

string

The ID of the request.

6BE0EDD1-0DE6-3EB6-81BF-BFE4F2******

Contoh

Respons sukses

JSONformat

{
  "PageNumber": 1,
  "PageSize": 30,
  "TotalCount": 1,
  "PatternDetails": [
    {
      "SQLPattern": "SELECT * FROM KEPLER_META_NODE_STATIC_INFO WHERE elastic_node = ? OR (elastic_node = ? AND enable = ?)",
      "PatternId": "5575924945138******",
      "User": "reporter",
      "AccessIp": "192.168.xx.xx",
      "Tables": "tpch.orders",
      "PatternCreationTime": "2021-11-12 03:06:00",
      "AverageQueryTime": 4,
      "MaxQueryTime": 2341,
      "AverageExecutionTime": 234.78,
      "MaxExecutionTime": 2142,
      "AveragePeakMemory": 234.22,
      "MaxPeakMemory": 234149,
      "AverageScanSize": 234149.23,
      "MaxScanSize": 234149,
      "QueryCount": 345,
      "FailedCount": 234,
      "Blockable": true,
      "QueryTimeSum": 5,
      "QueryTimePercentage": 10,
      "PeakMemorySum": 5,
      "PeakMemoryPercentage": 10,
      "ScanSizeSum": 5,
      "ScanSizePercentage": 80,
      "AverageOperatorCost": 5,
      "MaxOperatorCost": 5,
      "OperatorCostSum": 5,
      "OperatorCostPercentage": 20,
      "AverageScanCost": 5,
      "MaxScanCost": 5,
      "ScanCostSum": 5,
      "ScanCostPercentage": 5
    }
  ],
  "RequestId": "6BE0EDD1-0DE6-3EB6-81BF-BFE4F2******"
}

Kode kesalahan

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.