tencent cloud

Slow Log Overview
Last updated: 2024-11-13 21:54:24
Slow Log Overview
Last updated: 2024-11-13 21:54:24

Overview

Slow logs are also called slow SQL queries. They are a type of logs provided by TDSQL-C for MySQL to record SQL statements with a longer response time than the threshold in the database process. Specifically, SQL statements with a longer execution time than the long_query_time value are recorded in slow logs.
Note:
The slow log feature is currently in beta test and only available in Beijing region. It will be made available in more regions.

Parameters

The long_query_time value of TDSQL-C for MySQL defaults to 1, indicating that SQL statements running more than 1 seconds will be recorded in slow logs. You can adjust the value in the range of 0.000000 to 3,600.000000. For more information, see Setting Instance Parameters.

Purpose

After setting this parameter in TDSQL-C for MySQL, you can identify and optimize inefficient SQL statements. Simply put, slow logs are used to troubleshoot SQL statement issues and check the current performance.

Relevant operations

Operation
Use Case
Method
Prevent slow logs from being generated
Get suggestions from DBbrain for slow SQL statement optimization.
Set slow log parameters
Set the value of `long_query_time` to record slow logs.
View slow log monitoring alarms
View slow instance queries through the instance monitoring metric (Slow Queries) and set alarms to receive notifications.
Query and download slow log details
On the **Operation Log** page, query the following slow log information: execution time, SQL statement, client address, username, database, execution duration (s), lock duration (s), parsed rows, and returned rows. You can download them in CSV or native formats.
Analyze and optimize slow logs
View the complete SQL template, SQL sample, and optimization suggestion and description through DBbrain to analyze and optimize SQL statements.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback