Operation Logs

Last updated: 2021-04-06 10:33:27


    An 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 administrator (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, please see DescribeSlowLogs and DescribeBinlogs.


    TencentDB for MySQL instances (excluding basic single-node instances) support operation log management.

    Notes on slow queries in MySQL

    • long_query_time: slow query threshold parameter that is accurate to the microsecond level. The default value is 10 seconds. When an SQL statement takes more time than the threshold to execute, it will be recorded in a slow log.
      When the long_query_time parameter 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_queries_not_using_indexes: whether to log unindexed queries. The default value is OFF.


    1. Log in to the TencentDB for MySQL console. In the instance list, click the instance ID/name or Manage in the Operation column to access the instance management page.
    2. 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 detailsRecords SQL statements that took more than 10 seconds to execute in the database for the past month
      Slow log downloadDownloads slow logs
      Error log detailsRecords database execution error logs
      Rollback logsRecords the status and progress of rollback tasks
    3. To download the slow log, on the Download Slow Log tab, click Download in the Operation column.
    4. We recommend that you copy the download address in the pop-up dialog box, log in to a (Linux) CVM instance in the same VPC as the TencentDB instance, and run the wget command to download over the private network at a higher speed.


      • Logs with a size of 0 KB cannot be downloaded.
      • You can also click Download to download it directly. However, this may take longer.
      • wget command 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

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback