Mengkueri detail log kueri lambat untuk Kluster PolarDB Basis Data Relasional Cloud-Native.
Deskripsi operasi
-
This operation is supported only for PolarDB for MySQL clusters.
-
For PolarDB for PostgreSQL and PolarDB for PostgreSQL (Oracle Compatible) clusters, use the DAS API to query slow log records.
-
Starting September 1, 2024, the value of the
SQLHashfield will change due to an optimization of the SQL templating algorithm. For more information, see [Notice] Optimization of the templating algorithm for slow SQL queries.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
polardb:DescribeSlowLogRecords |
get |
*dbcluster
|
None | None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
ID Wilayah. Catatan
Anda dapat memanggil operasi DescribeRegions untuk mengkueri wilayah yang tersedia beserta ID wilayahnya. |
cn-hangzhou |
| DBClusterId |
string |
Yes |
ID Kluster. Catatan
Anda dapat memanggil operasi DescribeDBClusters untuk mengkueri semua kluster di wilayah target beserta ID klusternya. |
pc-************ |
| NodeId |
string |
No |
ID node. |
pi-********** |
| StartTime |
string |
Yes |
Awal pengatur waktu kueri. Tentukan waktu dalam UTC dengan format Catatan
|
2022-11-15T16:00Z |
| EndTime |
string |
Yes |
Akhir pengatur waktu kueri. Waktu akhir harus lebih lambat dari Waktu mulai. Pengatur waktu tidak boleh melebihi 24 jam. Tentukan waktu dalam UTC dengan format Catatan
Waktu harus dalam UTC. Jika layanan Anda berada di zona waktu yang berbeda, Anda harus mengonversi waktu. Misalnya, untuk mengkueri data dari 08:00 hingga 12:00 di zona waktu UTC+8, Anda harus mengatur pengatur waktu dari 00:00 UTC hingga 04:00 UTC. |
2022-11-16T04:00Z |
| DBName |
string |
No |
Nama database. |
testdb |
| PageSize |
integer |
No |
Jumlah Catatan per halaman. Nilai valid:
Nilai default: 30. |
30 |
| PageNumber |
integer |
No |
Nomor halaman. Nilai harus berupa bilangan bulat lebih besar dari 0. Nilai default: 1. |
1 |
| SQLHASH |
string |
No |
Hash SQL dari kueri lambat. Dapatkan hash ini dari statistik log kueri lambat untuk mengambil detail kueri lambat tertentu. |
U2FsdGVk**** |
Deskripsi.
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
|||
| DBClusterId |
string |
The cluster ID. |
pc-***************** |
| Engine |
string |
The database engine. |
polardb_mysql |
| Items |
object |
||
| SQLSlowRecord |
array<object> |
The slow query log records. |
|
|
object |
|||
| DBName |
string |
The name of the database. |
testdb |
| DBNodeId |
string |
The node ID. |
pi-***************** |
| ExecutionStartTime |
string |
The time when the SQL statement started to be executed. The time is in the |
2021-04-07T03:47Z |
| HostAddress |
string |
The address of the client that is connected to the database. |
testdb[testdb] @ [100.**.**.242] |
| LockTimes |
integer |
The lock duration of the SQL statement. Unit: seconds. |
0 |
| ParseRowCounts |
integer |
The number of parsed rows. |
0 |
| QueryTimeMS |
integer |
The query duration. Unit: milliseconds. |
100 |
| QueryTimes |
integer |
The execution duration of the SQL statement. Unit: seconds. |
20 |
| ReturnRowCounts |
integer |
The number of returned rows. |
0 |
| SQLHash |
string |
The unique identifier of the SQL statement. |
U2FsdGVk**** |
| SQLText |
string |
The SQL statement. |
/* Query from *** by user 111 */ SELECT sleep(20) |
| LockTimeMS |
integer |
100 |
|
| PageNumber |
integer |
The page number. |
1 |
| PageRecordCount |
integer |
The number of records on the current page. |
1 |
| RequestId |
string |
The request ID. |
A7E6A8FD-C50B-46B2-BA85-D8B8D3****** |
| TotalRecordCount |
integer |
The total number of records. |
1 |
deskripsi.
Contoh
Respons sukses
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)",
"LockTimeMS": 100
}
]
},
"PageNumber": 1,
"PageRecordCount": 1,
"RequestId": "A7E6A8FD-C50B-46B2-BA85-D8B8D3******",
"TotalRecordCount": 1
}
Kode kesalahan
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidStartTime.Malformed | The specified parameter StartTime is not valid. | |
| 404 | InvalidDBClusterId.NotFound | The DBInstanceId provided does not exist in our records. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.