A SQL statement query that takes more time than the specified value is referred to as a "slow query", and the corresponding statement is called a "slow query statement". The process where a database admin (DBA) analyzes slow query statements and finds out the reasons why slow queries occur is known as "slow query analysis".
You can view the slow logs details, error logs details, and rollback logs of an instance, and download slow logs on the operation log page in the console. You can also view and download database logs through the command line interface (CLI) or TencentDB APIs. For more information, see DescribeSlowLogs and DescribeBinlogs.
Currently, slow log download and rollback features are not supported for TencentDB for MySQL single-node instances of the cloud disk edition.
long_query_timeparameter is adjusted, existing slow logs will not be affected. For example, if the slow log threshold parameter is 10 seconds, the slow log records exceeding 10 seconds are reported. After this value is modified to 1 second, the previously reported logs will still be kept.
Log in to the TencentDB for MySQL console. In the instance list, click an instance ID or Manage in the Operation column to enter the instance management page.
On the Operation Log tab, you can view the slow logs details, error logs details, and rollback logs of the instance and download slow logs.
|Slow log details||Records SQL statements that took more than 10 seconds to execute in the database for the past month|
|Slow log download||Downloads slow logs|
|Error log details||Records the detailed information of each startup and shutdown as well as all the serious warnings and errors during operation|
|Rollback logs||Records the status and progress of rollback tasks|
On the Download Slow Log tab, click Download in the Operation column to download slow logs.
Copy the download address in the pop-up dialog box, log in to the Linux CVM in the same VPC as the TencentDB instance as instructed in Customizing Linux CVM Configurations, and run
wget to download the file over the high-speed private network.
- Logs with a size of 0 KB cannot be downloaded.
- You can also click Download to download it directly. However, this may take longer.
wgetcommand format: wget -c 'log file download address' -O custom filename.log
wget -c 'http://szx.dl.cdb.tencentyun.com:303/cfdee?appid=1210&time=1591&sign=aIGM%3D' -O test.log