Database Autonomy Service (DAS) uses MySQL's Performance Schema to collect low-level performance data for its Performance Insight feature. Enable Performance Schema before using Performance Insight.
Prerequisites
Before you begin, make sure that:
Your database instance is one of the following types:
ApsaraDB RDS for MySQL (Basic Edition and MySQL 5.5 are not supported)
ApsaraDB MyBase for MySQL
PolarDB for MySQL
Your instance has at least 8 GB of memory
Your instance is in one of the following regions: China (Hangzhou), China (Shanghai), China (Qingdao), China (Beijing), China (Zhangjiakou), China (Shenzhen), China (Chengdu), China (Hong Kong), Singapore, Malaysia (Kuala Lumpur), or Indonesia (Jakarta)
What changes when you enable Performance Schema
Performance Schema is a static parameter — changing it requires a database restart. Plan the restart in advance and make sure your application can automatically reconnect after the restart.
Enabling Performance Schema also consumes additional database resources. Review the stress testing report to assess the impact on your instance.
Check your current state
Before making any changes, verify whether Performance Schema is already enabled:
SHOW GLOBAL VARIABLES LIKE '%performance_schema';If the result shows performance_schema = ON, Performance Schema is already enabled. For ApsaraDB RDS for MySQL 5.7 and 8.0 instances with storage capacity of 8 GB or more, performance_schema is ON by default — you may be able to skip the rest of this procedure and proceed directly to verifying the additional parameters in step 4.
Enable Performance Schema
Step 1: Log on to the console
Log on to the console for your instance type:
ApsaraDB RDS for MySQL: ApsaraDB RDS console
PolarDB for MySQL: PolarDB console
Step 2: Find your instance
In the top navigation bar, select the region where your instance resides. In the instance list, find your instance and click its instance ID.
Step 3: Open the parameters page
Navigate to the parameter configuration page:
ApsaraDB RDS for MySQL: click Parameters in the left-side navigation pane
PolarDB for MySQL: choose Settings and Management > Parameters
Step 4: Set performance_schema to ON
Configure the performance_schema parameter based on your instance type and MySQL version:
| Instance type | MySQL version | Action |
|---|---|---|
| ApsaraDB RDS for MySQL | 5.6 | Find performance_schema and set Running Value to ON |
| ApsaraDB RDS for MySQL | 5.7 or 8.0 | performance_schema is ON by default for instances with storage capacity of 8 GB or more — verify with SHOW GLOBAL VARIABLES |
| PolarDB for MySQL | 5.6 or 5.7 | Select Cluster from the drop-down list, click Modify, find loose_performance_schema, and set it to ON in the Cluster Parameter column |
| PolarDB for MySQL | 8.0 | Select Cluster from the drop-down list, click Modify, find performance_schema, and set it to ON in the Cluster Parameter column |
For more information about Performance Schema internals, see MySQL Performance Schema in the MySQL documentation.
Step 5: Verify additional parameters (ApsaraDB RDS for MySQL only)
Skip this step for PolarDB for MySQL clusters — no additional parameter configuration is required.
For ApsaraDB RDS for MySQL instances, check that each of the following parameters has a value greater than 0. If any value is 0, Performance Insight cannot collect data.
For MySQL 5.6, only modify parameters that the instance supports.
For reference, see Performance Schema system variables in the MySQL documentation.
Parameters to check:
performance_schema_accounts_size
performance_schema_digests_size
performance_schema_error_size
performance_schema_max_digest_length
performance_schema_hosts_size
performance_schema_max_digest_sample_age
performance_schema_max_index_stat
performance_schema_max_sql_text_length
performance_schema_max_statement_classes
performance_schema_max_statement_stack
performance_schema_users_size
performance_schema_setup_actors_size
performance_schema_setup_objects_size
performance_schema_max_thread_classes
performance_schema_max_thread_instances
performance_schema_max_file_classes
performance_schema_max_file_instances
performance_schema_max_table_handles
performance_schema_max_table_instancesThe following sample values are a starting point. Replace each value with one appropriate for your workload:
loose_performance_schema_accounts_size=1000
loose_performance_schema_digests_size=10000
loose_performance_schema_error_size=10000
loose_performance_schema_max_digest_length=1024
loose_performance_schema_hosts_size=1000
loose_performance_schema_max_digest_sample_age=60
loose_performance_schema_max_index_stat=10000
loose_performance_schema_max_sql_text_length=1024
loose_performance_schema_max_statement_classes=256
loose_performance_schema_max_statement_stack=10
loose_performance_schema_users_size=10000
loose_performance_schema_setup_actors_size=10000
loose_performance_schema_setup_objects_size=10000
loose_performance_schema_max_thread_classes=100
loose_performance_schema_max_thread_instances=10000
loose_performance_schema_max_file_classes=256
loose_performance_schema_max_file_instances=1000
loose_performance_schema_max_table_handles=10000
loose_performance_schema_max_table_instances=1000Step 6: Submit the changes and restart
Submitting parameter changes restarts the database instance. Schedule the restart during off-peak hours and make sure your application can automatically reconnect after the restart.
Submit your parameter changes. After the instance restarts, verify that Performance Schema is active:
SHOW GLOBAL VARIABLES LIKE '%performance_schema';The result should show performance_schema = ON.
What's next
After enabling Performance Schema, use DAS Performance Insight to monitor query performance and identify bottlenecks.