All Products
Search
Document Center

Database Autonomy Service:GetStorageAnalysisResult

Last Updated:Apr 25, 2024

Queries the status and results of a storage analysis task.

Operation description

  • This operation is applicable only to ApsaraDB RDS for MySQL instances and PolarDB for MySQL clusters.
  • 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. Due to the asynchronicity of the statistics update mechanism in MySQL, statistics and analysis results may not be perfectly accurate. You can execute the ANALYZE TABLE statement on related tables during off-peak hours to obtain the latest information.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
hdm:GetStorageAnalysisResultWrite
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The instance ID.

rm-bp10xxxxxxxxx
NodeIdstringNo

The node ID.

Note This parameter is reserved.
202****
TaskIdstringYes

The task ID, which is returned after you call the CreateStorageAnalysisTask operation.

910f83f4b96df0524ddc5749f615****

Response parameters

ParameterTypeDescriptionExample
object
Codelong

The HTTP status code returned.

200
Messagestring

The returned message.

Note If the request is successful, Successful is returned. Otherwise, an error message such as an error code is returned.
Successful
Dataobject

The returned data.

TaskIdstring

The task ID.

910f83f4b96df0524ddc5749f615****
TaskFinishboolean

Indicates whether the task is complete.

true
TaskSuccessboolean

Indicates whether the task is successful.

true
TaskStatestring

The status of the storage analysis task. Valid values:

  • INIT: The task is being initialized.
  • PENDING: The task is being queued for execution.
  • RECEIVED: The task is received for execution.
  • RUNNING: The task is being executed.
  • RETRY: The task is being retried.
  • SUCCESS: The task succeeds.
  • FAILURE: The task fails.
RUNNING
TaskProgresslong

The task progress.

Note Valid values are integers that range from 0 to 100.
50
TotalDbCountlong

The number of databases that need to be analyzed in the storage analysis task.

32
AnalyzedDbCountlong

The number of databases that have been analyzed.

2
StorageAnalysisResultobject

The details of storage analysis.

TotalStorageSizelong

The total size of instance storage.

Note Unit: bytes.
214748364800
TotalUsedStorageSizelong

The size of used storage.

Note Unit: bytes.
68345135104
TotalFreeStorageSizelong

The size of remaining storage.

Note Unit: bytes.
146403229696
DailyIncrementlong

The estimated daily storage usage increment in the last seven days.

Note Unit: bytes.
0
EstimateAvailableDayslong

The estimated number of days before the remaining storage runs out.

99
AnalysisSuccessboolean

Indicates whether the analysis on the database and table is successful.

true
AnalysisErrorTypestring

The reason why the analysis on the database and table fails.

  • DB_OR_TABLE_NOT_EXIST: The specified database or table does not exist.
  • DB_NOT_EXIST: The specified database does not exist.
DB_NOT_EXIST
NeedOptimizeItemListobject []

The list of items to be optimized.

DbNamestring

The database name.

testdb01
TableNamestring

The table name.

test_table
OptimizeItemNamestring

The item to be optimized. Valid values:

  • NEED_ANALYZE_TABLE: The statistical data in information_schema.tables differs greatly from the physical file size.
  • NEED_OPTIMIZE_TABLE: The fragmentation degree of the table is high.
NEED_OPTIMIZE_TABLE
OptimizeAdvicestring

The optimization suggestion. Valid values:

  • NEED_ANALYZE_TABLE: You can execute the ANALYZE TABLE statement on the related table during off-peak hours.
  • NEED_OPTIMIZE_TABLE: You can reclaim fragments during off-peak hours.
NEED_OPTIMIZE_TABLE
AssociatedDatastring

The data associated with items to be optimized.

{ "autoIncrementCurrentValue": 2147483647, "autoIncrementRatio": 1, "dbName": "testdb01", "maximumValue": 2147483647, "columnName": "id", "tableName": "test_table" }
TableStatsobject []

The information about the table.

DbNamestring

The database name.

testdb01
TableNamestring

The table name.

test_table
TableTypestring

The table type.

BASE TABLE
Enginestring

The type of the engine used by the table.

InnoDB
PhysicalFileSizelong

The physical file size of the table.

Note Unit: byte. You may fail to obtain the physical file size because of the deployment mode of the database instance.
3057655808
PhyTotalSizelong

The size of the table storage.

Note Unit: byte. The value of the parameter is the sum of DataSize, IndexSize, and DataFree.
3012493312
TotalSizelong

The size of storage occupied by table data and indexes.

Note Unit: byte. The value of the parameter is the sum of DataSize and IndexSize.
3005153280
IndexSizelong

The size of storage occupied by indexes.

Note Unit: bytes.
1022296064
DataSizelong

The size of storage occupied by the table data.

Note Unit: bytes.
1982857216
DataFreelong

The size of storage occupied by fragments.

Note Unit: bytes.
7340032
TableRowslong

The number of rows in the table.

12794732
AvgRowLengthlong

The average row length.

Note Unit: bytes.
154
RequestIdstring

The request ID.

B6D17591-B48B-4D31-9CD6-9B9796B2****
Successboolean

Indicates whether the request is successful. Valid values:

  • true
  • false
true

Examples

Sample success responses

JSONformat

{
  "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
        }
      ]
    }
  },
  "RequestId": "B6D17591-B48B-4D31-9CD6-9B9796B2****",
  "Success": true
}

Error codes

HTTP status codeError codeError message
400InvalidParamsThe request parameters are invalid.
403NoPermissionYou are not authorized to do this action.

For a list of error codes, visit the Service error codes.