This topic describes how to collect table statistics in apsaradb for MySQL.
Alibaba Cloud reminds you that:
- When you perform operations that have risks, such as modifying instance configurations or data, check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
- Before you modify the configurations and data of instances including but not limited to ECS and RDS instances, we recommend that you create snapshots or enable RDS log backup.
- If you have authorized or submitted security 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.
What is statistical information?
The query optimizer of apsaradb for MySQL calculates the cost of different execution plans based on table statistics. Therefore, the accuracy of table statistics is essential for the query optimizer to select a correct execution plan.
Under what circumstances do you need to collect statistics?
If a large amount of data is modified in a table, for example, you load an ETL job or archive large amounts of historical data, we recommend that you manually collect the statistics. To ensure that the query optimizer can select the optimal execution plan.
How to collect statistics
analyze table [$Table_Name];
Note:[$Table_Name] is the table name.
- ApsaraDB RDS for MySQL