Consulta as estatísticas de log de consultas lentas para um cluster PolarDB.
Descrição da operação
-
Esta API está disponível apenas para PolarDB for MySQL.
-
A partir de 1º de setembro de 2024, o valor do campo SQLHash será alterado ao chamar esta API devido a uma otimização no algoritmo de modelagem de SQL. Para mais informações, consulte Otimização do algoritmo de modelagem para consultas SQL lentas.
Experimente agora
Testar
Autorização RAM
|
Ação |
Nível de acesso |
Tipo de recurso |
Chave de condição |
Ação dependente |
|
polardb:DescribeSlowLogs |
get |
*dbcluster
|
Nenhuma | Nenhuma |
Parâmetros da solicitação
|
Parâmetro |
Tipo |
Obrigatório |
Descrição |
Exemplo |
| RegionId |
string |
Sim |
O ID da região. |
cn-hangzhou |
| DBClusterId |
string |
Sim |
O ID do cluster. |
pc-**************** |
| StartTime |
string |
Sim |
A data de início do intervalo de consulta. A data pode ser de até 31 dias no passado. Especifique a data no formato |
2021-05-01Z |
| EndTime |
string |
Sim |
A data de término do intervalo de consulta. A data de término não pode ser anterior à data de início, e o intervalo entre as datas de início e término não pode exceder 31 dias. Especifique a data no formato |
2021-05-30Z |
| DBName |
string |
Não |
O nome do banco de dados. |
PolarDB_MySQL |
| PageSize |
integer |
Não |
O número de logs a serem retornados em cada página. Valores válidos: 30 a 100. O valor padrão é 30. |
30 |
| PageNumber |
integer |
Não |
O número da página. O valor padrão é 1. |
1 |
Elementos de resposta
|
Elemento |
Tipo |
Descrição |
Exemplo |
|
object |
|||
| TotalRecordCount |
integer |
O número total de registros. |
5 |
| PageRecordCount |
integer |
O número de instruções SQL na página atual. |
6 |
| EndTime |
string |
A hora de término da consulta. |
2021-05-30Z |
| RequestId |
string |
O ID da solicitação. |
2553A660-E4EB-4AF4-A402-8AFF70A49143 |
| PageNumber |
integer |
O número da página. |
3 |
| StartTime |
string |
A hora de início da consulta. |
2021-05-01Z |
| DBClusterId |
string |
O ID do cluster. |
pc-**************** |
| Items |
object |
||
| SQLSlowLog |
array<object> |
Detalhes dos logs de consultas lentas. |
|
|
object |
|||
| SQLText |
string |
The SQL statement. |
select id,name from tb_table |
| ReturnMaxRowCount |
integer |
The maximum number of returned rows. |
3 |
| CreateTime |
string |
The time when the slow query log was generated. |
2021-05-30Z |
| MaxExecutionTime |
integer |
The maximum 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 time. Unit: seconds. |
2 |
| DBNodeId |
string |
The node ID. |
pi-*************** |
| SQLHASH |
string |
The unique ID of the SQL statement. You can use this ID to obtain the details of the slow query. |
U2FsdGVkxxxx |
| ParseMaxRowCount |
integer |
The maximum number of scanned rows. |
1 |
| MaxLockTime |
integer |
The maximum lock duration. Unit: seconds. |
1 |
| ReturnTotalRowCounts |
integer |
The total number of returned rows. |
1 |
| DBName |
string |
The database name. |
PolarDB_MySQL |
| TotalExecutionCounts |
integer |
The total number of executions. |
2 |
| MaxExecutionTimeMs |
string |
The maximum execution time. Unit: milliseconds. |
60000 |
| Engine |
string |
O mecanismo de banco de dados. |
polardb_mysql |
Exemplos
Resposta de sucesso
JSON formato
{
"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"
}
Códigos de erro
|
Código de status HTTP |
Código de erro |
Mensagem de erro |
Descrição |
|---|---|---|---|
| 400 | InvalidStartTime.Malformed | The specified parameter StartTime is not valid. | The specified StartTime parameter is invalid. |
Consulte Códigos de Erro para uma lista completa.
Notas de versão
Consulte Notas de Versão para uma lista completa.