Ensure that the "slow_query_log" database flag is enabled for your Google Cloud MySQL database instances in order to simplify the task of finding inefficient or time-consuming SQL queries for your MySQL databases. By default, the "slow_query_log" database flag is not enabled for Google Cloud MySQL instances.
The slow query log feature designed for MySQL databases enables you to log queries that exceed a predefined time limit. By enabling the "slow_query_log" flag, you can keep an eye on your MySQL database performance, allowing you to identify which queries need optimization. Optionally, you can integrate these logs with Google Cloud Operations service (formerly Stackdriver) to create and configure alerts that can send you notifications when there are too many slow queries and your database performance is downgraded.
Note: Some database flag settings can affect instance availability and/or stability, and eventually remove the MySQL instance from the Google Cloud SQL Service Level Agreement (SLA).
To determine if "slow_query_log" flag is enabled for your MySQL database instances, perform the following operations:
Remediation / Resolution
To enable the "slow_query_log" database flag for your Google Cloud Platform (GCP) MySQL database instances, perform the following actions:
- Google Cloud Platform (GCP) Documentation
- Cloud SQL for MySQL
- Configuring database flags
- Editing instances
- Monitoring slow queries in MySQL with Cloud Logging and Monitoring
- MySQL Database Documentation
- 5.1.7 Server System Variables
Unlock the Remediation Steps
Gain free unlimited access
to our full Knowledge Base
Over 750 rules & best practices
You are auditing:
Enable "slow_query_log" Flag for MySQL Database Servers
Risk level: Medium