Updated on 2024-10-14 GMT+08:00

Managing Disk Capacity

DBA Assistant allows you to view the storage usage of your DB instance in real time to prevent insufficient storage space.

Overview

  1. Log in to the management console.
  2. Click in the upper left corner and select a region.
  3. Click in the upper left corner of the page and choose Databases > Relational Database Service.
  4. On the Instances page, click the target DB instance name.
  5. In the navigation pane, choose DBA Assistant > Real-Time Diagnosis.
  6. Click the Storage Analysis tab to view storage usage. If your storage is insufficient, scale it up.

    If the average daily increase in last week is 0 GB, the estimated available days of storage are unlimited and are not displayed.

Abnormal Tables

This function counts tables with abnormal tablespace growth, tables without primary keys, and tables without indexes. To use this function, subscribe to Intelligent O&M first.

  1. Click the Storage Analysis tab to view abnormal tables.

    Figure 1 Abnormal Tables

  2. Click Subscribe. In the displayed dialog box, you can learn about Intelligent O&M functions and pricing.

    Figure 2 Subscribing to Intelligent O&M

  3. After subscribing to Intelligent O&M, view the table diagnosis results of your instance.

    Figure 3 Table diagnosis results

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

    Figure 4 Configuring a daily tablespace increase limit

Disk Space Distribution

You can view storage space distribution of your instance.

Figure 5 Disk space distribution

If the total number of files in your disk space (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 disk space distribution and usages over time on the console. This prevents performance slowdowns caused by collecting statistics on too many files. If this happens, contact technical support.

  • Data space: Disk space occupied by user data (including temporary table files and ib_logfile files generated by the database)
  • Binlog: Disk space occupied by binlogs
  • Slow query log: Disk space occupied by slow logs
  • Relay log: Disk space occupied by relay logs
  • Audit log: Disk space occupied by audit logs
  • Temporary space: Disk space occupied by temporary files
  • Other: Disk space occupied by files such as ib_buffer_pool, ib_doublewrite, and error.log generated by the instance.

Top Databases and Tables by Physical File Size

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.
  • A database or table whose name contains special characters, including slashes (/) and #p#p, is not counted.
  • Top databases and tables are available only in RDS for MySQL 5.7 and 8.0.
  • If the instance memory usage is greater than 85% or there are more than 50,000 tables in your instance, to prevent data collection from affecting the instance performance, top databases and tables will not be counted.
Figure 6 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 7 Viewing data volume changes

FAQ

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

A: Reduce the storage usage by referring to Instance Becomes Read-Only When 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:
  • Scale up the storage space: Services are not interrupted during storage scale-up. You can also enable autoscaling. When the available storage of a DB instance drops to the threshold, autoscaling is triggered.
  • Reducing disk data: Delete useless historical data.
    1. If your instance becomes read-only, you need to contact customer service to cancel the read-only status 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 clear up space, you can optimize tables with a high fragmentation rate during off-peak hours.

      To delete data of an entire table, run DROP or TRUNCATE. To delete part of table data, run DELETE and OPTIMIZE TABLE.

  • 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.