Updated on 2026-11-17 GMT+08:00

Managing Storage Capacity

Function Description

When using DB instances, users are mainly concerned about data and log storage usages as well as their historical growth. RDS for MySQL shows you the distribution and changes of used storage on the Storage Analysis page. It also provides storage autoscaling, intelligent tablespace diagnosis, and analysis of top 50 largest databases and tables.

Table 1 Functions

Function

Description

Related Operations

Overview

You can view storage usage, available storage, total storage, daily increase in the last week, and estimated available days of storage.

Viewing the Storage Overview

Intelligent Tablespace Diagnosis

It shows you tables with abnormal tablespace growth, tables without primary keys, and tables without indexes.

Intelligent Tablespace Diagnosis

Used Storage and Used Storage over Time

You can view the distribution of storage space and its changes over time.

Used Storage over Time

Top Databases and Tables

You can view the top 50 databases and tables by physical file size and identify the databases and tables with high usage based on storage space distribution.

Top Databases and Tables by Physical File Size

Clear Table Fragments

Among the top 50 tables, you can defragment non-system tables.

Defragmenting Tables

Procedure

  1. Log in to the RDS console.
  2. Click in the upper left corner and select a region.
  3. On the Instances page, click the target instance name to go to the Summary page.
  4. In the navigation pane, choose Storage Analysis under DBA Assistant.
  5. Check your storage usage. If the storage is insufficient, scale it up. Or you can enable storage autoscaling.

    Figure 1 Overview

    If the average daily increase over the past week is 0 GB, indicating that no storage has been used during that period, the estimated available storage days are considered unlimited and are not displayed.

    If the total number of files in your storage (including data space, binlog space, slow query log space, relay log space, audit log space, temporary space, and other space) exceeds 10,000, RDS will not collect information about the files or display space distribution and usages over time on the console. This prevents performance slowdowns caused by collecting statistics on too many files. If this happens, submit a service ticket.

    • Data: Disk space occupied by user data (including temporary table files and ib_logfile files generated by the database)
    • Binlogs: Disk space occupied by binlogs
    • Slow query logs: Disk space occupied by slow query logs
    • Relay logs: Disk space occupied by relay logs
    • Audit logs: Disk space occupied by audit logs
    • Temporary space: Disk space occupied by temporary files
    • Other: Disk space occupied by files such as ibdata1, ib_buffer_pool, ib_doublewrite, and error.log, plus the reserved space (about 5% of the disk space) for OS

This function counts tables with abnormal tablespace growth, tables without primary keys, and tables without indexes. To use this function, upgrade DBA Assistant first.

  1. Click the Storage Analysis tab to view tablespace diagnosis results.

    Figure 2 Intelligent tablespace diagnosis

  2. Click Upgrade DBA Assistant. In the displayed dialog box, you can learn about the enhanced features and billing rules.

    Figure 3 Upgrading DBA Assistant

  3. After the upgrade is complete, view the tablespace diagnosis results of your instance.

    Figure 4 Tablespace diagnosis results

  4. Click next to Auto Diagnosis. In the displayed dialog box, configure the daily tablespace increase limit and click OK.

    Figure 5 Configuring a daily tablespace increase limit

You can view storage changes and diagnose the storage usage.

Figure 6 Used storage over time
  1. Above the chart, click Trend Diagnosis, select the diagnosis interval, and click OK.
    • The diagnosis usually takes a few minutes. You can only query diagnosis results generated within 1 hour. If the results have expired, run the diagnosis again.
    • If the end time is not the current time, temporary files are not diagnosed.
    Figure 7 Trend diagnosis
  2. After the diagnosis is complete, click Trend Diagnosis Result Query.
  3. In the displayed dialog box, click Diagnosis Details to view the handling suggestions for each diagnosis item.
    Figure 8 Viewing diagnosis results

You can view the top 50 databases and tables by physical file size and identify the databases and tables with high usage based on storage space distribution.

  • Physical file sizes are precisely recorded, but other fields' values are estimated. If there is a large gap between a file size and another field, run ANALYZE TABLE on the table.
  • Databases or tables with names containing reserved special characters, such as slashes (/) or #p#p, cannot be counted.
  • If your instance's memory usage is greater than 85% or it has more than 50,000 tables, RDS will not collect related information. This prevents performance slowdowns caused by collecting statistics on too many databases and tables.
Figure 9 Top 50 databases

Click View Chart to view data volume changes in the last 7 days, last 30 days, or a custom time period (spanning no more than 30 days).

Figure 10 Viewing data volume changes

Among the top 50 tables, you can defragment non-system tables.

  • Do not perform defragmentation when the instance is executing other tasks. Otherwise, these tasks may fail.
  • Defragmentation tasks for tables are mutually exclusive and must be executed in a queue to reduce impact on instance performance.
  • A table is defragmented by running the OPTIMIZE statement on it. During this process, the table is temporarily locked.
  • Defragmenting a table often requires significant time and resources. You need to reserve storage space that is at least 1.5 times the size of this table.
  • Canceling an ongoing defragmentation task will damage MyISAM tables and make them unavailable. Exercise caution when performing this operation.
  • After a table defragmentation is complete, the system will update fragmentation statistics for the table.
  • When you configure defragmentation for a primary/standby or cluster instance, if Standby node only is not selected, the system will defragment tables on all nodes in the instance. If Standby node only is selected, only the standby nodes will be defragmented.

In the Top 50 Tables list, find the target table and click Clear Fragments in the Operation column. In the displayed dialog box, select an option for Executed and click OK. Then, a confirmation prompt appears. Click OK.

Figure 11 Defragmenting tables immediately
Figure 12 Defragmenting tables during a maintenance window
After the task is delivered, return to the instance list. In the navigation pane on the left, choose Task Center and check the defragmentation task status.
  • If you have selected Now for Executed:
    • On the Instant Tasks page, search for Clearing MySQL table fragments and check the execution progress.
    • During the execution of an instant task, you can click Cancel to cancel the task.
  • If you have selected Maintenance window for Executed:
    • On the Scheduled Tasks page, search for the defragmentation task using the DB instance ID and check the task status.
    • When the scheduled task is in the To be executed state, you can click Cancel to cancel it.
    • When the scheduled task runs, an instant task is created on the Instant Tasks tab page. If you cancel this instant task, the scheduled task is also canceled and its status changes to Failed.

For details, see Task Center.

FAQ

Q: What can I do if the storage space of my DB instance is full?

A: Reduce the storage usage by referring to Conditions for an Instance to Become Read-Only When the Storage Is Full, so that the DB instance becomes available and data can be written to the instance. You can use either of the following methods to reduce the storage usage:
  • Scaling up storage: Workloads are not interrupted during storage scale-up. You can configure storage autoscaling. When the storage usage hits your specified limit, storage autoscaling is triggered.
  • Reducing disk data: Delete useless historical data.
    1. If your instance becomes read-only, unlock it from this state first. If your instance is not in the read-only state, you can delete data directly.
    2. Check the top 50 databases and tables with large physical files and identify the historical table data that can be deleted. For details, see Top Databases and Tables by Physical File Size.
    3. To free up space, you can run OPTIMIZE on tables with a high fragmentation rate during off-peak hours.

      To delete data of an entire table, run DROP or TRUNCATE. To delete only part of table data, run DELETE. However, after performing DELETE, you need to run OPTIMIZE TABLE to reclaim the released storage space.

  • If temporary files generated by sorting queries occupy too much storage space, optimize your SQL query statements.

    You can query slow query logs, and analyze and optimize the problematic SQL statements.