All Products
Search
Document Center

Database Autonomy Service:GetAutoIncrementUsageStatistic

Last Updated:Apr 25, 2024

Queries the usage of auto-increment table IDs.

Operation description

  • This operation is applicable only to ApsaraDB RDS for MySQL instances and PolarDB for MySQL clusters.
  • If you use an Alibaba Cloud SDK or Database Autonomy Service (DAS) SDK to call this operation, we recommend that you use the latest version of the SDK.
  • If you use an SDK to call DAS, you must set the region to cn-shanghai.

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:GetAutoIncrementUsageStatisticWrite
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The instance ID.

rm-2ze8g2am97624****
DbNamesstringNo

The database name. If you specify a database, the operation queries the usage of auto-increment table IDs in the specified database. Otherwise, the operation queries the usage of auto-increment table IDs in all databases on the instance.

Note Specify the parameter value as a JSON array, such as ['db1','db2']. Separate multiple database names with commas (,).
['db1','db2']
RatioFilterdoubleYes

The usage threshold of auto-increment IDs. Only usage that exceeds the threshold can be returned. Valid values are decimals that range from 0 to 1.

0.9
RealTimebooleanYes

Specifies whether to query real-time data. Valid values:

  • true: queries data in real time except for data generated in the last 10 minutes.****
  • false: queries data generated in the last 2 hours. If no such data exists, queries the latest data.
false

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.

Finishboolean

Indicates whether the task is complete. Valid values:

  • true
  • false
false
Timestamplong

The time when the request was made. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1697183353000
TaskStatusstring

The task status. Valid values:

  • INIT: The task is being initialized.
  • RUNNING: The task is being executed.
  • SUCCESS: The task succeeds.
  • FAIL: The task fails.
INIT
ErrorInfostring

The error message returned if the task fails.

the given database name list invalid, none of the database names in the list exist on the instance
AutoIncrementUsageListobject []

The usage details of auto-increment IDs.

DbNamestring

The database name.

db01
TableNamestring

The table name.

test_table
ColumnNamestring

The column name.

id
AutoIncrementCurrentValuelong

The latest auto-increment ID.

2147483647
MaximumValuelong

The maximum auto-increment ID that is supported by the current data type.

2147483647
AutoIncrementRatiodouble

The usage ratio of auto-increment IDs.

1
RequestIdstring

The request ID.

0A74B755-98B7-59DB-8724-1321B394****
Successboolean

Indicates whether the request is successful. Valid values:

  • true
  • false
true

Examples

Sample success responses

JSONformat

{
  "Code": 200,
  "Message": "Successful",
  "Data": {
    "Finish": false,
    "Timestamp": 1697183353000,
    "TaskStatus": "INIT",
    "ErrorInfo": "the given database name list invalid, none of the database names in the list exist on the instance",
    "AutoIncrementUsageList": [
      {
        "DbName": "db01",
        "TableName": "test_table",
        "ColumnName": "id",
        "AutoIncrementCurrentValue": 2147483647,
        "MaximumValue": 2147483647,
        "AutoIncrementRatio": 1
      }
    ]
  },
  "RequestId": "0A74B755-98B7-59DB-8724-1321B394****",
  "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.