Consulta o status e os resultados de uma tarefa de análise de armazenamento.
Descrição da operação
O tamanho do arquivo físico indica o tamanho real de um arquivo obtido. Apenas modos de implantação específicos de instâncias de banco de dados suportam a exibição de tamanhos de arquivos físicos. As estatísticas das tabelas são obtidas de information_schema.tables. As estatísticas no MySQL não são atualizadas em tempo real. Portanto, as estatísticas podem ser diferentes dos tamanhos dos arquivos físicos. Se você quiser obter os dados mais recentes, pode executar a instrução ANALYZE TABLE nas tabelas relevantes durante os horários de menor movimento.
-
Esta operação é aplicável apenas a instâncias do ApsaraDB RDS for MySQL, clusters do PolarDB for MySQL e instâncias do ApsaraDB for MongoDB.
-
Para instâncias do ApsaraDB RDS for MySQL e clusters do PolarDB for MySQL, esta operação funciona da mesma forma que o recurso de análise de armazenamento da versão anterior. As tarefas geradas por esta operação não podem ser visualizadas na página Análise de Armazenamento da nova versão no console do Database Autonomy Service (DAS). Se você quiser visualizar as tarefas e os resultados, chame a operação de API relacionada para obter os dados e salvá-los em seu computador.
-
Se você usar um SDK do Alibaba Cloud ou SDK do DAS para chamar esta operação, recomendamos que use a versão mais recente do SDK.
-
Se você usar um SDK para chamar operações do DAS, deverá definir o ID da região como cn-shanghai.
Experimente agora
Testar
Autorização RAM
|
Ação |
Nível de acesso |
Tipo de recurso |
Chave de condição |
Ação dependente |
|
hdm:GetStorageAnalysisResult |
none |
*All Resource
|
Nenhuma | Nenhuma |
Parâmetros da solicitação
|
Parâmetro |
Tipo |
Obrigatório |
Descrição |
Exemplo |
| InstanceId |
string |
Sim |
O ID da instância. |
rm-2ze1jdv45i7l6**** |
| NodeId |
string |
Não |
O ID do nó. Nota
Este parâmetro é reservado. |
None |
| TaskId |
string |
Sim |
O ID da tarefa. Você pode obter o ID da tarefa a partir da resposta da operação CreateStorageAnalysisTask. |
910f83f4b96df0524ddc5749f615**** |
Elementos de resposta
|
Elemento |
Tipo |
Descrição |
Exemplo |
|
object |
The response parameters. |
||
| Code |
integer |
O código de status HTTP retornado. |
200 |
| Message |
string |
A mensagem retornada. Nota
Se a solicitação for bem-sucedida, Successful será retornado. Caso contrário, uma mensagem de erro, como um código de erro, será retornada. |
Successful |
| Data |
object |
Os dados retornados. |
|
| TaskId |
string |
O ID da tarefa. |
910f83f4b96df0524ddc5749f615**** |
| TaskFinish |
boolean |
Indica se a tarefa está concluída. |
true |
| TaskSuccess |
boolean |
Indica se a tarefa foi bem-sucedida. |
true |
| TaskState |
string |
O status da tarefa de análise de armazenamento. Valores válidos:
|
SUCCESS |
| TaskProgress |
integer |
O progresso da tarefa. Nota
Os valores válidos são números inteiros que variam de 0 a 100. |
100 |
| TotalDbCount |
integer |
O número de bancos de dados que precisam ser analisados na tarefa de análise de armazenamento. |
32 |
| AnalyzedDbCount |
integer |
O número de bancos de dados que foram analisados. |
2 |
| StorageAnalysisResult |
object |
Os detalhes da análise de armazenamento. |
|
| TotalStorageSize |
integer |
The total size of instance storage. Nota
Unit: bytes. |
214748364800 |
| TotalUsedStorageSize |
integer |
The size of used storage. Nota
Unit: bytes. |
68345135104 |
| TotalFreeStorageSize |
integer |
The size of remaining storage. Nota
Unit: bytes. |
146403229696 |
| DailyIncrement |
integer |
The estimated average daily growth of the used storage space in the previous seven days. Unit: bytes. |
0 |
| EstimateAvailableDays |
integer |
The estimated number of days for which the remaining storage space is available. |
99 |
| AnalysisSuccess |
boolean |
Indicates whether the analysis on the database and table is successful. |
true |
| AnalysisErrorType |
string |
The reason why the analysis on the database and table fails.
|
DB_NOT_EXIST |
| NeedOptimizeItemList |
array<object> |
The items to be optimized, which are generated based on DAS default rules. You can ignore these items based on your business requirements, and create custom rules to generate items to be optimized based on other basic data that is returned. |
|
|
object |
|||
| DbName |
string |
The name of the database. |
testdb01 |
| TableName |
string |
The name of the table. |
test_table |
| OptimizeItemName |
string |
The item to be optimized. Valid values:
|
NEED_OPTIMIZE_TABLE |
| OptimizeAdvice |
string |
The optimization suggestion. Valid values:
|
NEED_OPTIMIZE_TABLE |
| AssociatedData |
string |
The data associated with the items to be optimized, which is in the JSON format. |
{ "autoIncrementCurrentValue": 2147483647, "autoIncrementRatio": 1, "dbName": "testdb01", "maximumValue": 2147483647, "columnName": "id", "tableName": "test_table" } |
| TableStats |
array<object> |
The information about the table. |
|
|
object |
|||
| DbName |
string |
The name of the database. |
testdb01 |
| TableName |
string |
The name of the table. |
test_table |
| TableType |
string |
The type of the table. Nota
This parameter is applicable only to ApsaraDB RDS for MySQL instances and PolarDB for MySQL clusters. |
BASE TABLE |
| Engine |
string |
The type of the storage engine used by the table. Nota
This parameter is applicable only to ApsaraDB RDS for MySQL instances and PolarDB for MySQL clusters. |
InnoDB |
| PhysicalFileSize |
integer |
The physical file size of the table. Unit: bytes. Nota
This parameter is applicable only to ApsaraDB RDS for MySQL instances and PolarDB for MySQL clusters. Data of specific database instances cannot be obtained due to deployment mode. |
3057655808 |
| PhyTotalSize |
integer |
The storage space of the table. Unit: bytes. Nota
For ApsaraDB RDS for MySQL instances and PolarDB for MySQL clusters, the value of the parameter is the sum of DataSize, IndexSize, and DataFree. For ApsaraDB for MongoDB instances, the value of this parameter is the sum of DataSize and IndexSize. |
3012493312 |
| TotalSize |
integer |
|
3005153280 |
| IndexSize |
integer |
The storage space occupied by indexes. Unit: bytes. |
1022296064 |
| DataSize |
integer |
|
1982857216 |
| DataFree |
integer |
The size of space fragments. Unit: bytes. Nota
This parameter is applicable only to ApsaraDB RDS for MySQL instances and PolarDB for MySQL clusters. The fragmentation rate of a table is generally calculated based on the following formula: |
7340032 |
| TableRows |
integer |
The number of rows in the table. |
12794732 |
| AvgRowLength |
integer |
The average length of rows. Unit: bytes. |
154 |
| FragmentSize |
integer |
The size of space that can be reclaimed. Unit: bytes. Nota
This parameter is applicable only to ApsaraDB for MongoDB instances. |
362221568 |
| RequestId |
string |
O ID da solicitação. |
B6D17591-B48B-4D31-9CD6-9B9796B2**** |
| Success |
boolean |
Indica se a solicitação foi bem-sucedida. Valores válidos:
|
true |
Exemplos
Resposta de sucesso
JSON formato
{
"Code": 200,
"Message": "Successful",
"Data": {
"TaskId": "910f83f4b96df0524ddc5749f615****",
"TaskFinish": true,
"TaskSuccess": true,
"TaskState": "SUCCESS",
"TaskProgress": 100,
"TotalDbCount": 32,
"AnalyzedDbCount": 2,
"StorageAnalysisResult": {
"TotalStorageSize": 214748364800,
"TotalUsedStorageSize": 68345135104,
"TotalFreeStorageSize": 146403229696,
"DailyIncrement": 0,
"EstimateAvailableDays": 99,
"AnalysisSuccess": true,
"AnalysisErrorType": "DB_NOT_EXIST",
"NeedOptimizeItemList": [
{
"DbName": "testdb01",
"TableName": "test_table",
"OptimizeItemName": "NEED_OPTIMIZE_TABLE",
"OptimizeAdvice": "NEED_OPTIMIZE_TABLE",
"AssociatedData": "{\n \"autoIncrementCurrentValue\": 2147483647,\n \"autoIncrementRatio\": 1,\n \"dbName\": \"testdb01\",\n \"maximumValue\": 2147483647,\n \"columnName\": \"id\",\n \"tableName\": \"test_table\"\n}"
}
],
"TableStats": [
{
"DbName": "testdb01",
"TableName": "test_table",
"TableType": "BASE TABLE",
"Engine": "InnoDB",
"PhysicalFileSize": 3057655808,
"PhyTotalSize": 3012493312,
"TotalSize": 3005153280,
"IndexSize": 1022296064,
"DataSize": 1982857216,
"DataFree": 7340032,
"TableRows": 12794732,
"AvgRowLength": 154,
"FragmentSize": 362221568
}
]
}
},
"RequestId": "B6D17591-B48B-4D31-9CD6-9B9796B2****",
"Success": true
}
Códigos de erro
|
Código de status HTTP |
Código de erro |
Mensagem de erro |
Descrição |
|---|---|---|---|
| 400 | InvalidParams | The request parameters are invalid. | |
| 403 | NoPermission | You are not authorized to do this action. |
Consulte Códigos de Erro para uma lista completa.
Notas de versão
Consulte Notas de Versão para uma lista completa.