Unable to query performance_schema in ApsaraDB RDS for MySQL

Updated at:

Problem

When you run theselect * from performance_schema.threads query on an ApsaraDB RDS for MySQL instance, the result is empty.

Cause

Theperformance_schema parameter is disabled by default in ApsaraDB RDS for MySQL to prevent performance degradation.

Note

The Performance Schema in MySQL collects performance data.

  • Provides detailed information about thread waits, including locks, mutexes, and file I/O.

  • Stores aggregated statistics for historical events to help optimize MySQL server performance.

  • Lets you add or remove monitoring events and dynamically change the server's monitoring interval.

You can confirm that this parameter is disabled by running the SHOW VARIABLES LIKE 'performance_schema'; command in the DMS SQL console. The command returns OFF.

Solutions

  • For instances running MySQL 5.6 or 5.7, you can modify the performance_schema parameter in the console. For more information, see Set instance parameters.

    Note

    Modifying theperformance_schema parameter restarts the instance. Plan this operation carefully to avoid disrupting your services.

  • MySQL 5.5 does not support modifying this parameter.

  • If you cannot modify the performance_schema parameter on your ApsaraDB RDS for MySQL 8.0 instance, check the parameter template that the instance uses. For more information about how to view the parameter template that your instance uses, see Use parameter templates. You cannot configure theperformance_schema parameter when using theMySQL_8.0_High-availability_High-performance Parameter Template. You must switch to the default parameter template before you can modify the parameter. To switch the parameter template, perform the following steps:

    1. Go to the Instances page. In the top navigation bar, select the region of your instance, and then click the target instance ID.

    2. In the left-side navigation pane, click Parameters.

    3. Click Apply Template.

    4. SelectMySQL_8.0_High-availability_Default Parameter Template and click OK.

      Note

      Switching the parameter template restarts the instance.

Applies to

ApsaraDB RDS for MySQL