Overview
This topic describes how to use MySQL to query table file sizes.
Detail
Alibaba Cloud reminds you that:
- Before you perform operations that may cause risks, such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
- You can modify the configurations and data of instances including but not limited to Elastic Compute Service (ECS) and Relational Database Service (RDS) instances. Before the modification, we recommend that you create snapshots or enable RDS log backup.
- If you have authorized or submitted sensitive information such as the logon account and password in the Alibaba Cloud Management Console, we recommend that you modify such information in a timely manner.
In MySQL 5.7, you can run the following SQL statement to view the size of table files:
SELECT file_name,concat(TOTAL_EXTENTS,'MB') as 'FileSize' FROM INFORMATION_SCHEMA.FILES order by TOTAL_EXTENTS DESC limit 20;
Note: The table file size is not displayed in mysql.slow_log log files. If the disk space usage of the instance greatly differs from the query script, you can run the following SQL statement and then check the disk space usage.
truncate table mysql.slow_log
Application scope
- ApsaraDB RDS for MySQL