Queries table statistics in a specific AnalyticDB for MySQL cluster.

Note For more information about table statistics, see View monitoring information of resource pools.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeTableStatistics

The operation that you want to perform. Set the value to DescribeTableStatistics.

DBClusterId String Yes am-****************

The ID of the cluster.

Note You can call the DescribeDBClusters operation to query details about all AnalyticDB for MySQL clusters in a specific region, including cluster IDs.
PageSize Integer No 30

The number of entries to return on each page. Valid values: 30, 50, and 100. Default value: 30.

PageNumber Integer No 1

The number of the page to return. The value must be an integer that is greater than 0. Default value: 1.

Order String No [ { "Field":"TableName", "Type":"Asc" } ]

The order in which to sort the retrieved records by field. Specify this value in the JSON format. The value is an ordered array that uses the order of the input array and contains Field and Type. Example: [{ "Field":"TableName", "Type":"Asc" }].

  • In the example, Field indicates the field that is used to sort the retrieved records. Set the value of Field to TableName.
  • Type indicates the sort type. Valid values (case-insensitive):
    • Desc: The entries are sorted in descending order.
    • Asc: The entries are sorted in ascending order.

Response parameters

Parameter Type Example Description
TotalCount String 1

The total number of entries.

PageSize String 30

The number of entries returned on the current page.

RequestId String 4C4433FF-5D3A-4C3E-A19C-6D93B2******

The ID of the request.

PageNumber String 1

The page number of the returned page.

DBClusterId String am-****************

The ID of the cluster.

Items Array of TableStatisticRecords

Details about table statistics.

TableStatisticRecords
SchemaName String test_schema

The name of the database.

TableName String test_table

The name of the table.

RowCount Long 3

The number of rows in the table.

DataSize Long 15592

The amount of data in the table. Unit: byte.

IndexSize Long 3076

The amount of data in indexes. Unit: byte.

PrimaryKeyIndexSize Long 16340

The amount of data in primary key indexes. Unit: byte.

PartitionCount Long 1

The number of partitions.

ColdDataSize Long 0

The total amount of cold data. Unit: byte.

Note The parameter is returned only when the engine version of the cluster is 3.1.3.4 or later.

Examples

Sample requests

http(s)://adb.aliyuncs.com/?Action=DescribeTableStatistics
&DBClusterId=am-****************
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeTableStatisticsResponse>
    <TotalCount>1</TotalCount>
    <RequestId>4C4433FF-5D3A-4C3E-A19C-6D93B2******</RequestId>
    <PageSize>30</PageSize>
    <PageNumber>1</PageNumber>
    <DBClusterId>am-****************</DBClusterId>
    <Items>
        <TableStatisticRecords>
            <TableName>test_table</TableName>
            <ColdDataSize>0</ColdDataSize>
            <DataSize>15592</DataSize>
            <PrimaryKeyIndexSize>16340</PrimaryKeyIndexSize>
            <IndexSize>3076</IndexSize>
            <RowCount>3</RowCount>
            <PartitionCount>1</PartitionCount>
            <SchemaName>test_schema</SchemaName>
        </TableStatisticRecords>
    </Items>
</DescribeTableStatisticsResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "TotalCount" : 1,
  "RequestId" : "4C4433FF-5D3A-4C3E-A19C-6D93B2******",
  "PageSize" : 30,
  "PageNumber" : 1,
  "DBClusterId" : "am-****************",
  "Items" : {
    "TableStatisticRecords" : [ {
      "TableName" : "test_table",
      "ColdDataSize" : 0,
      "DataSize" : 15592,
      "PrimaryKeyIndexSize" : 16340,
      "IndexSize" : 3076,
      "RowCount" : 3,
      "PartitionCount" : 1,
      "SchemaName" : "test_schema"
    } ]
  }
}

Error codes

HTTP status code Error code Error message Description
404 InvalidDBCluster.NotFound The DBClusterId provided does not exist in our records. The error message returned because the specified cluster ID does not exist. Check whether the cluster ID is valid.

For a list of error codes, visit the API Error Center.