Updated on 2023-10-18 GMT+08:00

Viewing Slow Query Logs


Slow query logs record statements that exceed long_query_time (10 seconds by default). You can view log details and statistics to identify statements that are executing slowly and optimize the statements.

GaussDB(for MySQL) supports the following statement types:
  • DROP

Parameter Description

Table 1 Parameters related to slow queries




Specifies how many seconds a SQL query has to take to be recorded in slow query logs. The default value is 10s. You are advised to set this parameter to 1s.

The lock wait time is not calculated into the query time.


Specifies whether to record the slow query that without indexes. The default value is OFF.


Specifies the SQL statement that can be written to the slow query log every minute. The default value is 0.

Viewing Log Details

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Click in the upper left corner of the page, choose Database > GaussDB(for MySQL).
  4. On the Instances page, click the instance name to go to the Basic Information page.
  5. In the navigation pane on the left, choose Logs.
  6. On the Slow Query Logs page, view the slow query log details.

  7. View slow query logs of different nodes in a given database and SQL statement types. In the upper right corner of the page:

    Enter a database name, click the drop-down list, and select your desired node.

    Click the drop-down list and select a SQL statement type (SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, or DROP).

    Click and specify a time period.

    Figure 1 Viewing slow query logs