This topic describes how to use RDS for MySQL to drop large tables asynchronously.
Background
When the data file of a table is large, deleting the table synchronously can impact the running instance and cause I/O jitters.
Function introduction
RDS for MySQL supports dropping large tables asynchronously. After you enable the feature to drop large tables asynchronously, the kernel automatically deletes large tables asynchronously, which reduces the performance fluctuations on the instance caused by the delete operation. You do not need to perform any other operations after deleting a table. The kernel automatically completes the remaining tasks. When you delete a large table asynchronously, its data file is first renamed to a temporary file. Then, a background thread smoothly truncates the temporary file.
Use cases
This feature is suitable for business scenarios that require deleting large tables and are sensitive to performance fluctuations.
Supported version
- MySQL 5.7 version, and the kernel minor version is MySQL 5.7.32_20241015 and above.
- MySQL 8.0 version, and the kernel minor version is MySQL 8.0.32_20240215 and above.
- MySQL 8.4 version, and the kernel minor version is MySQL 8.4.7_20260415 and above.
Instructions
Asynchronous deletion of large tables is disabled by default. You can use this feature by setting the modifiable parameters loose_innodb_data_file_logic_drop and loose_innodb_data_file_logic_drop_max_size.
- Modify loose_innodb_data_file_logic_drop to ON to enable this feature.
- Modify loose_innodb_data_file_logic_drop_max_size to specify the file size to be truncated in the background each time a large table is deleted asynchronously.
tip
The background truncation frequency of RDS for MySQL is 5 times per second. For example, if loose_innodb_data_file_logic_drop_max_size is configured as 1024 MiB, theoretically, 5 GiB of data files are truncated per second.
For more information about loose_innodb_data_file_logic_drop and loose_innodb_data_file_logic_drop_max_size, refer to the following table.
Procedure
You can use this feature by setting the modifiable parameters loose_innodb_data_file_logic_drop and loose_innodb_data_file_logic_drop_max_size. RDS for MySQL supports modifying parameters through the console and Open API.
- Modify through the console