Mengambil statistik log kueri lambat untuk cluster PolarDB.
Deskripsi operasi
-
API ini hanya tersedia untuk PolarDB for MySQL.
-
Mulai 1 September 2024, nilai field SQLHash akan berubah saat Anda memanggil API ini karena adanya optimasi pada algoritma templating SQL. Untuk informasi lebih lanjut, lihat Optimasi algoritma templating untuk kueri SQL lambat.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
polardb:DescribeSlowLogs |
get |
*dbcluster
|
None | None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
ID region. |
cn-hangzhou |
| DBClusterId |
string |
Yes |
ID cluster. |
pc-**************** |
| StartTime |
string |
Yes |
Tanggal mulai rentang kueri. Tanggal dapat berupa hingga 31 hari di masa lalu. Tentukan tanggal dalam format |
2021-05-01Z |
| EndTime |
string |
Yes |
Tanggal akhir rentang kueri. Tanggal akhir tidak boleh lebih awal dari tanggal mulai, dan interval antara tanggal mulai dan akhir tidak boleh melebihi 31 hari. Tentukan tanggal dalam format |
2021-05-30Z |
| DBName |
string |
No |
Nama database. |
PolarDB_MySQL |
| PageSize |
integer |
No |
Jumlah log yang dikembalikan pada setiap halaman. Nilai yang valid: 30 hingga 100. Nilai default adalah 30. |
30 |
| PageNumber |
integer |
No |
Nomor halaman. Nilai default adalah 1. |
1 |
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
|||
| TotalRecordCount |
integer |
Jumlah total catatan. |
5 |
| PageRecordCount |
integer |
Jumlah pernyataan SQL pada halaman saat ini. |
6 |
| EndTime |
string |
Waktu akhir kueri. |
2021-05-30Z |
| RequestId |
string |
ID permintaan. |
2553A660-E4EB-4AF4-A402-8AFF70A49143 |
| PageNumber |
integer |
Nomor halaman. |
3 |
| StartTime |
string |
Waktu mulai kueri. |
2021-05-01Z |
| DBClusterId |
string |
ID cluster. |
pc-**************** |
| Items |
object |
||
| SQLSlowLog |
array<object> |
Detail log kueri lambat. |
|
|
object |
|||
| SQLText |
string |
The SQL statement. |
select id,name from tb_table |
| ReturnMaxRowCount |
integer |
The maximum number of rows returned for the SQL statement. |
3 |
| CreateTime |
string |
The date when the data was generated. |
2021-05-30Z |
| MaxExecutionTime |
integer |
The longest execution time. Unit: seconds. |
60 |
| ParseTotalRowCounts |
integer |
The total number of scanned rows. |
2 |
| TotalLockTimes |
integer |
The total lock duration. Unit: seconds. |
1 |
| TotalExecutionTimes |
integer |
The total execution duration. Unit: seconds. |
2 |
| DBNodeId |
string |
The node ID. |
pi-*************** |
| SQLHASH |
string |
The unique identifier (ID) of the SQL statement in the slow query log statistics. You can use this ID to query the details of the slow query. |
U2FsdGVkxxxx |
| ParseMaxRowCount |
integer |
The maximum number of scanned rows. |
1 |
| MaxLockTime |
integer |
The longest lock duration. Unit: seconds. |
1 |
| ReturnTotalRowCounts |
integer |
The total number of rows returned for the SQL statement. |
1 |
| DBName |
string |
The database name. |
PolarDB_MySQL |
| TotalExecutionCounts |
integer |
The total number of executions. |
2 |
| MaxExecutionTimeMs |
string |
60000 |
|
| Engine |
string |
Mesin database. |
polardb_mysql |
Contoh
Respons sukses
JSONformat
{
"TotalRecordCount": 5,
"PageRecordCount": 6,
"EndTime": "2021-05-30Z",
"RequestId": "2553A660-E4EB-4AF4-A402-8AFF70A49143",
"PageNumber": 3,
"StartTime": "2021-05-01Z",
"DBClusterId": "pc-****************",
"Items": {
"SQLSlowLog": [
{
"SQLText": "select id,name from tb_table",
"ReturnMaxRowCount": 3,
"CreateTime": "2021-05-30Z",
"MaxExecutionTime": 60,
"ParseTotalRowCounts": 2,
"TotalLockTimes": 1,
"TotalExecutionTimes": 2,
"DBNodeId": "pi-***************",
"SQLHASH": "U2FsdGVkxxxx",
"ParseMaxRowCount": 1,
"MaxLockTime": 1,
"ReturnTotalRowCounts": 1,
"DBName": "PolarDB_MySQL",
"TotalExecutionCounts": 2,
"MaxExecutionTimeMs": "60000"
}
]
},
"Engine": "polardb_mysql"
}
Kode kesalahan
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidStartTime.Malformed | The specified parameter StartTime is not valid. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.