Queries the status and results of a storage analysis task.
Operation description
The physical file size indicates the actual size of an obtained file. Only specific deployment modes of database instances support the display of physical file sizes. The statistics on tables are obtained from information_schema.tables. Statistics in MySQL are not updated in real time. Therefore, the statistics may be different from the physical file sizes. If you want to obtain the latest data, you can execute the ANALYZE TABLE statement on the relevant tables during off-peak hours.
-
This operation is applicable only to ApsaraDB RDS for MySQL instances, PolarDB for MySQL clusters, and ApsaraDB for MongoDB instances.
-
For ApsaraDB RDS for MySQL instances and PolarDB for MySQL clusters, this operation works the same as the storage analysis feature of the previous version. Tasks generated by this operation cannot be viewed on the Storage Analysis page of the new version in the Database Autonomy Service (DAS) console. If you want to view the tasks and results, call the related API operation to obtain data and save data to your computer.
-
If you use an Alibaba Cloud SDK or DAS SDK to call this operation, we recommend that you use the latest version of the SDK.
-
If you use an SDK to call operations of DAS, you must set the region ID to cn-shanghai.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
hdm:GetStorageAnalysisResult |
none |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
The instance ID. |
rm-bp10xxxxxxxxx |
| NodeId |
string |
No |
The node ID. Note
This parameter is reserved. |
202**** |
| TaskId |
string |
Yes |
The task ID. You can obtain the task ID from the response of the CreateStorageAnalysisTask operation. |
910f83f4b96df0524ddc5749f615**** |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| Code |
integer |
The HTTP status code returned. |
200 |
| Message |
string |
The returned message. Note
If the request is successful, Successful is returned. Otherwise, an error message such as an error code is returned. |
Successful |
| Data |
object |
The data returned. |
|
| TaskId |
string |
The task ID. |
910f83f4b96df0524ddc5749f615**** |
| TaskFinish |
boolean |
Indicates whether the task is complete. |
true |
| TaskSuccess |
boolean |
Indicates whether the task is successful. |
true |
| TaskState |
string |
The status of the storage analysis task. Valid values:
|
RUNNING |
| TaskProgress |
integer |
The task progress. Note
Valid values are integers that range from 0 to 100. |
50 |
| TotalDbCount |
integer |
The number of databases that need to be analyzed in the storage analysis task. |
32 |
| AnalyzedDbCount |
integer |
The number of databases that have been analyzed. |
2 |
| StorageAnalysisResult |
object |
The details of storage analysis. |
|
| TotalStorageSize |
integer |
The total size of instance storage. Note
Unit: bytes. |
214748364800 |
| TotalUsedStorageSize |
integer |
The size of used storage. Note
Unit: bytes. |
68345135104 |
| TotalFreeStorageSize |
integer |
The size of remaining storage. Note
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. Note
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. Note
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. Note
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. Note
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. Note
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. Note
This parameter is applicable only to ApsaraDB for MongoDB instances. |
362221568 |
| RequestId |
string |
The request ID. |
B6D17591-B48B-4D31-9CD6-9B9796B2**** |
| Success |
boolean |
Indicates whether the request is successful. Valid values:
|
true |
Examples
Success response
JSON format
{
"Code": 200,
"Message": "Successful",
"Data": {
"TaskId": "910f83f4b96df0524ddc5749f615****",
"TaskFinish": true,
"TaskSuccess": true,
"TaskState": "RUNNING",
"TaskProgress": 50,
"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
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParams | The request parameters are invalid. | |
| 403 | NoPermission | You are not authorized to do this action. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.