Database Autonomy Service (DAS) provides the automatic recycling feature for tablespace fragments. This feature can help optimize the usage of tablespace. After you enable this feature for your database instance, DAS runs the OPTIMIZE TABLE or ALTER TABLE command on the primary instance to recycle tablespace fragments.
Prerequisites
- DAS Professional Edition is enabled for the database instance. For more information, see Purchase DAS Professional Edition.
- The database instance is an ApsaraDB RDS for MySQL instance of the High-availability Edition and has been available for at least 14 days.
- The database instance has at least four CPU cores.
- Physical tables use the InnoDB engine.
Items that the system checks before it recycles tablespace fragments
To mitigate the negative impacts of tablespace fragment recycling on database performance and tablespace, the system checks the database instance and the tables in the instance.
- If one or more of the following requirements are not met, tablespace fragment recycling
cannot be performed on the corresponding table.
- The available storage space of the database instance must be at least three times
larger than the physical space of the table whose tablespace fragments you want to
recycle.
Note For example, if you want to recycle the tablespace fragments of the Table_1 table whose physical space is 30 GB, the available storage space of the database instance must be greater than or equal to 90 GB when tablespace fragment recycling is triggered.
- No full-text indexes are created for the table.
- The available storage space of the database instance must be at least three times
larger than the physical space of the table whose tablespace fragments you want to
recycle.
- If one or more of the following requirements are not met, the system waits for approximately
1 to 5 minutes and then performs the checks again. This process is repeated until
the maintenance window ends.
- No backup tasks are being performed on the database instance.
- No schema change tasks are being performed.
- The CPU utilization during the same period of time on the previous day and the CPU
utilization during the same period of time on the day that is seven days earlier than
the current date must be less than 70%, and the CPU utilization before the recycling
task is scheduled to start must be less than 80%.
Note For example, assume that tablespace fragment recycling is scheduled to start at 03:00 on December 10 for a table whose physical space is 90 GB, and the operation is expected to take 30 minutes to complete. You must make sure that the following requirements are met:
- The CPU utilization must be less than 70% from 03:00 to 03:30 on December 9, 2020.
- The CPU utilization must be less than 70% from 03:00 to 03:30 on December 3, 2020.
- The CPU utilization must be less than 80% from 03:00 on December 9, 2020 to the time when the recycling starts.
- Before the system recycles the tablespace fragments of a table, the system checks
the table. If one or more of the following requirements are not met, the system does
not start the recycling task:
- No SQL statements that take longer than 3 seconds to execute exist.
- No pending transactions exist. Pending transactions are the transactions that hold locks but are not committed within 15 seconds.
- The number of active sessions on the table is less than 64.