What Should I Do If My Data Exceeds the Available Storage of an RDS DB Instance?

Scenario

There is not enough storage available for an RDS DB instance and the DB instance has entered read-only status, or applications can no longer read from or write to the databases, interrupting services.

Causes

Possible causes include:

  • Too much data being stored.

  • Too many MySQL binlog files being generated due to a large number of transactions and write operations.

  • A large number of temporary files being generated due to a large number of sorting queries executed by applications.

Solution

  1. If your DB instance becomes read-only because there is too much data, contact technical support to cancel the read-only status and run statements to delete useless historical table data to free up space. To delete data of an entire table, run DROP or TRUNCATE. To delete part of table data, run DELETE and OPTIMIZE TABLE. If the instance still supports read and write operations, directly delete unless historical table data. If no historical data can be deleted, scale up your storage space.

  2. If MySQL binlog files are taking up too much space, contact technical support to delete local binlog files to free up storage space.

  3. If temporary files generated by sorting queries are taking up too much space, optimize your SQL query statements.

  4. If none of these solutions work, use database and table sharding.